Swift Language FAQ
Check out our Swift language FAQ, filled with answers to tons of common questions about Apple’s brand new programming language! By Chris Wagner.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
Swift Language FAQ
25 mins
- The Basics
- I’m a beginner. Should I learn Objective-C, Swift, or both?
- I’ve been an Objective-C developer for YEARS. Am I now a beginner?
- Will iOS 8 and OS X Yosemite apps only use Swift?
- Does Swift work with other versions of iOS and OS X?
- Is Swift meant to replace Objective-C, or supplement it?
- What is a playground?
- Is the NDA lifted yet?
- How can I learn Swift?
- Will your future books and tutorials use Swift?
- Diving Right In
- Is there anything that Swift can do that Objective-C can’t, and vice-versa?
- Are there any APIs that don’t work with Swift?
- Where are my println() results in my Playground?
- How do I see those cool graphs of values in Playgrounds?
- How do you run the REPL?
- Can you use Swift to call your own Objective-C code or a third party library? If so, how?
- So, arrays can only contain one type of object? What if I want varied types?
- Is the same true for dictionaries? Are dictionaries also strongly typed?
- The Nitty Gritty
- Is there an equivalent to id in Swift?
- How do you do introspection in Swift? (e.g. equivalent of if ([obj isKindOfClass:[Foo class]]) { ... })?
- How do you put bitshifted values inside an enum in Swift? (i.e. MyVal = 1<<5)
- How does Swift work with Grand Central Dispatch?
- What about the internationalization macros from Objective-C?
- Do I need to worry about reference cycles?
- When should I use strong vs. weak vs. unowned references?
- Where are the semi-colons?!
- What are best practices with Swift coding style?
- What's Next?
- What is the future of Swift?
- How will CocoaPods adapt to Swift?
- More Questions?
What's Next?
What is the future of Swift?
This is only version 1, Apple's intentions are clear that they will be iterating on this language.
To get an idea of what may be coming down the pipeline, check out Karol Mazur's excellent summary of posts from Apple to the dev forums.
So be sure to report bugs and request features! There is a lot of room to see improvements before version 1 is officially released.
How will CocoaPods adapt to Swift?
Likely in a similar way. Swift projects still work as Xcode projects and support multiple targets. There is however potential room for improvement with the ability to create modules and custom frameworks.
It is possible that CocoaPods will be reworked to utilize this feature. There are people who have CocoaPods working with Swift projects and the smart people who work on CocoaPods are already discussing this topic.
More Questions?
If you have any questions that were not covered here (I know you do!) please post a comment. I will pick out some of the best ones and update the post with the question and answer - and also give you attribution for asking!
Also, as mentioned earlier, please chime in with any comments or clarifications on the answers listed here and I'll update as appropriate.
Thanks all, and happy Swift'ing!