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

combine swift in Objective-C project #108

Closed
liuxuan30 opened this issue May 27, 2015 · 1 comment
Closed

combine swift in Objective-C project #108

liuxuan30 opened this issue May 27, 2015 · 1 comment

Comments

@liuxuan30
Copy link
Member

I am not familiar how swift and Objective-C works together, so i got some questions to ask:

on ios-chart home page, it mentions:

iOS 7.0 (Drag .swift files to your project)
iOS 8.0 (Use as an Embedded Framework)

Q1: if my Objective-C project needs to support iOS 7 & 8, what am I supposed to do? Do I have to do both 'drag .swift files' and 'embed the framework' ?

Q2: I heard that currently the apps that contain swift stuff will have a swift runtime bundled with each app, and the app size become larger. Is it true? It is a kind of waste that every app has to embed a swift runtime.

Q3: The most dreaded thing I was worried is about bugs about bridging swift and Objective-C code working together. Has anyone met such issues that only can be solved by Apple fixing them or upgrading swift?

I have apps which is being used by clients and I implemented similar charts as ios-charts does but in Objective-C, lots of animations, delegate, gestures, and I am willing to switch to ios-charts and do some contributions, so I don't have to write each chart myself, working with smart people will only make the chart library better and better. However I am very concerned I will met weird bugs that is caused by swift and objective-C compatibility issues. It will be very convincible that someone had similar situation can share some experience about using to this awesome library in Objective-C project.

@danielgindi
Copy link
Collaborator

A1: Aim for the lowest common factor. If you need both 7 & 8, drag the
Swift files. If you need only 8, drag the project file and embed as a
framework.

A2: They contain the runtime so updates to Swift do not limit you to newer
iOS versions. The runtime does not weigh so much that you even need to ask
this question.......

A3: I've waited for Swift 1.2 to make this library "officialy released"
sine there were some basic features missing. Now there are only two cases
where I've seen the bridging to fail and the Swift functions to not be
available in Objc, and these are pretty idiotic cases. I'm sure they eill
be fixed soon but until then I've created special methods to bridge to Objc
(same methods, suffixed by "Objc").

A4: Swift has been proven to provide way better performance. Objc has been
proven to be a cool language. Use both whenever you want. There's no need
to switch to Swift and forget Objc, or to be afraid from Swift.

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