Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does sandbox project have to include numsw project? #12

Open
sonsongithub opened this issue Mar 5, 2017 · 4 comments
Open

Does sandbox project have to include numsw project? #12

sonsongithub opened this issue Mar 5, 2017 · 4 comments
Assignees

Comments

@sonsongithub
Copy link
Owner

No description provided.

@omochi
Copy link
Collaborator

omochi commented Mar 5, 2017

This is complex discussion.

In sandbox, there are following facts.

  • [1]: [Double] types are at plotting APIs.
  • [2]: CGPoint, CGAffineTransform types are at rendering transformation calculation.

There is no numsw types. but,...

  • [3]: This is better to change 1 to numsw Matrix ( or Vector ?) types in future.
  • [4]: This may be better to change 2 to numsw Matrix types in future,
    but in this case, we need to add 3D transformation utilities to numsw such like translation, rotation etc. Is this follow design philosophy of numsw ?

Anyway at least about [3], sandbox project need to include numsw maths.

Next, there are 2 possibilities of build structure.

  • [5]: sandbox xcode project include numsw xcode project which generate Framework bundle.
  • [6]: sandbox xcode project include directly numsw math sources to itselfs.

In ordinary iOS development, [5] is natural.
But we treat playground package project and it can not include Framework bundle. So pattern [5] have a more different between sandbox app and actual playground package. its bad.
To efficient development, we need to reduce difference.

So I think pattern [6] is better.

Finally, I have more one option.

Should we need sandbox xcode project ?
[7] We can make sandbox app target into numsw xcode project and delete sandox project.

There is one problem about math test codes.
We add test files to sandbox project to run them on iOS devices.
But it split test code management from math development workflow I think.
Plan [7] may solve this disjunction.

@omochi
Copy link
Collaborator

omochi commented Mar 8, 2017

Playground上ではパッケージが無いので、numswとPlaygroundsは同じパッケージに無いといけない。つまり、RenderViewControllerからMatrixを使う時、ファイル冒頭に import numsw は書かない。
よって、sandboxターゲットでは、numswとPlaygroundsの全てのソースが突っこまれる。

一方、numsw上ではnumswとテストコードは別れているので、テストコードの冒頭には @testable import numsw と書く。
これを、sandbox側に取り込んでテストコードを実行しようとすると、 バンドル名が sandbox であるため、 @testable import numsw がエラーになる。

現状は、このimportを通すため、sandboxにソースで入ってるnumswとは別に、さらにnumsw.xcodeprojで生成されるnumsw.frameworkを突っ込んでいる。つまり、 numsw.Matrixsandox.Matrix の両方が入ってる。

sandboxのバンドル名をnumswに変えるのは他の問題が起こりそうなのでやりたくない。

@omochi
Copy link
Collaborator

omochi commented Mar 8, 2017

数学関係のクラスが追加されたりしたときに、numsw.xcodeproj側とsandbox.xcodeproj側で2重に対応するのは、対応漏れするとおかしくなりそうなので微妙。
そう考えると、sandbox.xcodeprojからnumsw.xcodeprojを参照させて、numsw.Frameworkを取り込むのが良い。
問題は、sandbox側のPlaygrounds系のソースで、 import numsw と書く事になってしまって、肝心のPlaygroundの方で動かなくなってしまう事。

そこで、sandbox.xcodeprojのときだけフラグを立てて、プロプロセッサで import numsw が書かれるようにして、Playgroundの時はそれが書かれないようにする。

@omochi
Copy link
Collaborator

omochi commented Mar 8, 2017

#38 で対応。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants