Quantcast
Channel: Envato Tuts+ Code - Mobile Development
Viewing all articles
Browse latest Browse all 1836

What's New in Xcode 8

$
0
0
tag:code.tutsplus.com,2005:PostPresenter/cms-26799

During WWDC, Apple traditionally gives developers a sneak peek of the next major release of its IDE, Xcode. With every major release, the company improves its developer tools and adds a number of compelling new features. And this year was no different.

1. Swift 2 and 3

Up until Xcode 8, every version of Xcode was tied to a specific version of the Swift programming language. That is no longer true as of Xcode 8. Swift 3 introduces a slew of changes and a considerable number of these changes are breaking.

Projects created with Xcode 8 use Swift 3 by default. Fortunately, Xcode 8 includes a build setting that gives developers the ability to stick with Swift 2, Swift 2.3 to be precise.

Use Legacy Swift Language Version

This means that you can choose when you want to migrate a project to Swift 3. To configure a target for Swift 2.3, open the target's build settings and set Use Legacy Swift Language Version to Yes.

Xcode 8 also includes a migration tool that helps you migrate a project to Swift 3. I have had mixed results with the migration tool of Xcode 7. Swift 3 introduces many, many changes and I hope the migration tool has improved considerably when Xcode 8 is ready for release.

2. Source Editor Extensions

One of the most surprising features was the introduction of source editor extensions. Developers have been asking for a native plugin architecture for many years. Source editor extensions are a first good step in that direction.

There is a lot to like about extensions for Xcode, but Apple emphasizes that extensions are currently focused on manipulating and navigating the contents of the source editor hence source editor extensions. Xcode 8 even includes a template to help you get up to speed.

Xcode Source Editor Extension Template

What I especially like about the extension architecture is that every extension runs in a separate process. This means that a crashing extension doesn't cause Xcode to quit unexpectedly. This frequently caused issues with homegrown plugins, especially if Apple shipped a new major release of Xcode.

Another benefit extensions have over plugins is security. You can sign and distribute extensions using your developer account. Apple also mentioned that you can use the Mac App Store for distributing extensions. This is a great option if you are interested in making some money with the extensions you make.

I am very excited about source editor extensions. While I am a big fan of Alcatraz, Apple's native implementation of extensions seem the way forward. I cannot wait to see what kind of extensions developers are going to build. There are already a few available on GitHub.

3. Debugging

Even the best developers spend a considerable chunk of their time debugging and Apple understands the need for better tools to make this task easier. Xcode 8 introduces a number of significant improvements related to debugging.

View Debugging

View debugging is much more powerful in Xcode 8. Reliability has improved and debugging ambiguous or unsatisfiable layouts is much easier thanks to an improved view debugger that displays runtime issues.

Runtime issues? That's right. Xcode 8 introduces runtime issues in addition to buildtime issues. If you run into Auto Layout issues at runtime, Xcode shows you the issue as a runtime issue in the Issues Navigator on the left. This is a very welcome addition.

Runtime Issues

Memory Debugging

Xcode 8 also sports a pretty impressive memory debugger for tracking down memory leaks and retain cycles. I am not sure how useful it is going to be in practice, but it looks very, very nice.

Memory Debugging

4. Code Signing

Code signing is a necessary evil for developers interested in Apple's platforms. Fortunately, Apple isn't burying its head in the sand. It understands the pain developers are having. Even veterans are struggling with code signing issues from time to time. During this year's Platforms State of the Union, Apple even made fun of its own Fix Issue button that rarely fixed the issue and sometimes made things even worse.

The Fix Issue button usually doesnt fix the issue

Code signing issues should be a thing of the past with Xcode 8. For every target, you can check a checkbox that tells Xcode to manage code signing on your behalf. This option is enabled by default for new projects. When checked, Xcode manages certificates, provisioning profiles, and application identifiers for you.

Code Signing Done for You

I hope Apple got it right this time. And with me tens of thousands of other developers.

5. Other Improvements and Enhancements

San Francisco Mono

If you enjoy working with beautifully crafted software, then you may enjoy Apple's new San Francisco Mono font that ships with Xcode 8. It is a monospaced variant of San Francisco and blends in neatly with the system font of macOS.

San Francisco Mono

Line Highlighting

Did you notice that the current line is highlighted in the above screenshot? That is another welcome enhancement Apple added to Xcode 8. I currently use Backlight for Xcode to achieve the same effect in Xcode 7. I guess I no longer need that plugin in Xcode 8.

Code Completion for Images

Speaking of ditching third party plugins, I currently use Kent Sutherland's excellent KSImageNamed plugin to enable code completion for images in Xcode. I won't be needing that plugin when I switch to Xcode 8 as this feature is now built into Xcode.

Code Completion for Images

6. Documentation

Developers spend an inordinate amount of time browsing and reading documentation. Good documentation goes a long way and Apple's documentation is excellent. Browsing the documentation is a different story.

This pain is now resolved in Xcode 8. The new documentation format looks gorgeous and the documentation browser is fast and easy to use. Apple also consolidated the documentation for its platforms, resulting in a much smaller memory footprint.

And, yes, documentation can look gorgeous. Take a look at these screenshots if you don't believe me.

New Documentation Browser
New Documentation Browser

Conclusion

It goes without saying that I only covered a subset of what is new in Xcode 8. The next major release of Xcode is always something I look forward to. Developers spend so much time in their code editor and it is therefore understandable that they care about its evolution, both good and bad. What is your favorite feature of Xcode 8? Share it in the comments.

2016-07-01T14:55:05.443Z2016-07-01T14:55:05.443ZBart Jacobs

Viewing all articles
Browse latest Browse all 1836

Trending Articles