Xcode 9 Loves Swift
I feel it is no exaggeration to say that this is the year that Apple finally delivers a Xcode for Swift developers. There will be those that say ‘yes but they didn’t do X or Y’, I get that. But they gave us a lot, here are some of the big list items that you should care about.
The first one deserves a big font because it is that important
Yup, I know right! We can finally refactor not only Objective-C and C
Another big improvement is wireless development. We no longer need to plug devices into our Mac to work with device testing and development. For wireless development to work your device needs to be running iOS 11 and macOS 10.12.4 or later. The connection runs over either Wifi or ethernet, naturally you can if you want still connect via the USB cable.
To enable the wireless connection all you need to do is go to ’Devices and Simulator’ under the ’Windows’ menu in Xcode and turn on ’Connect via network’. For Apple TV there is a slightly different process, you need to go to ’Remote App and Devices’ on the AppleTV and it will then appear in Xcode where you enter a code.
There is a noticeable speed increase in the code editor, I really do mean noticeable. It is a delight to work with longer code files without waiting for the editor to catch up. Apple says file opening is three times faster, scrolling takes place at sixty frames per second and jumping to a line is fifty times faster.
Whilst we are talking about the editor, it now has a built-in markdown editor and those somewhat helpful error and warning indicators no longer cover up your code. There is over three hundred new fix-it’s and analyzers to go along with the newer helpful indicator.
Hovering over code now highlights the structure in the editor, if you click on the highlight it will give the options to help improve the code.
Other editor improvements include
- When implementing a protocol that requires methods, the fix it will offer to add them to your code for you.
- Method and variable extraction.
- Convert if/else and switch statements to and from each other.
- Features an open source refactoring engine.
- Fifty times faster searching.
The iOS simulator now sports a fancy looking bevel to help it stand out more compared to other windows, plus the hardware buttons now work and swiping is supported.
Finally, we can run multiple instances, this gives the ability to test different hardware at the same time. You can also resize these devices to any size you wish, this is great news if you are running on a laptop with a lower resolution.
Support for GitHub and GitHub Enterprise is built right into Xcode 9. When creating a new project you can setup a GitHub repository at the same time in just a few simple steps, this is a great time saver.
When browsing GitHub, you will notice a new button ‘Open in Xcode’. With one click you can setup a new project, link and download (clone) a repository to start working.
- There is a totally new build system written in Swift that not only indexes while building but runs two and a half times faster.
- You know that disconnect between Xcode project structure and the actual file system? No more! Finally, they will match. This is long overdue.
- Xcode Server functionality is now built directly into Xcode 9.
- You can use Swift 3.2 and Swift 4 in the same projects
Xcode 9 is a big release with plenty for Swift and Objective-C developers to smile about. What is your favorite new feature?