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

Why is MetalPetal written in Objective C ? #52

Closed
omarojo opened this issue Nov 6, 2018 · 2 comments
Closed

Why is MetalPetal written in Objective C ? #52

omarojo opened this issue Nov 6, 2018 · 2 comments

Comments

@omarojo
Copy link

omarojo commented Nov 6, 2018

Hi thank you for developing this amazing framework, making our lives way more easy.

As I start moving to Metal because of OpenGLES deprecation by Apple. I looked into GPUImage3 and MetalPetal. But I realized that MetalPetal is written in ObjectiveC, I wonder if there is a specific reason why is that, since Swift is meant to be the future of Apple software development.

I cant help to wonder, what may happen if Apple slowly switch to Swift ONLY apps in years to come. Would it be wise to write such a complex (and big) framework such as MetalPetal in ObjectiveC right now ?

are there any plans for a Swift rewrite ?

This is just a general doubt, because I wanna be cautious when choosing the right technology (framework/lib) before investing development time in my own long term projects.

Anyways, great job you are doing there. As a second adjacent question.
Are you guys being funded by a larger corporation, or are you powered by Donations, If so it would be great to know how we can contribute.

Cheers

@YuAo
Copy link
Member

YuAo commented Nov 7, 2018

MetalPetal chooses Objective-C with the following reasons:

  • Apple wrote Metal.framework in Objective-C/C++.
  • MetalPetal's current design can be well implemented using Objective-C.
  • We can provide a thin Swift layer over the Objective-C implementation to make Swift users "feel at home". (MetalPetal/Swift, NS_SWIFT_NAME, etc.)
  • We have Objective-C audiences.
  • If we finally need to switch to Swift, we can easily maintain source compatibility. This means the framework users (you) do not need to change a single line of code when the framework itself switches to Swift.
  • Other considerations: Some "tricks" can be done more easily on Objective-C side; Some SIMD types (simd_uint8, simd_uint16, simd_int8, simd_int16, etc) are not available with Swift (as of Swift 4.2); We cannot interact with JavaScript interfaces with pure Swift class/struct (Yes, we developed a JavaScript interface: MetalPetalJS! You can use JavaScript with JavaScriptCore.framework to build filters/image processing pipelines).

We try to design MetalPetal to be a better framework instead of just following the trends. There's no plan to switch to Swift currently. We'd like to wait until we see more advantages of using Swift instead of Objective-C, or Apple rewrites Metal.framework using Swift.

If you'd like to make MetalPetal better, you can start by using it in your own project, provide your feedback/bug report, write blogs about how you make use of MetalPetal, or provide design proposals and bug fixes.

@YuAo YuAo closed this as completed Nov 7, 2018
@omarojo
Copy link
Author

omarojo commented Nov 7, 2018

Thank you for your well versed response.
Appreciated.

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