Swift Developer News - Hacking with Swift News, tips, and tutorials from Hacking with Swift https://www.hackingwithswift.com/articles/rss (c)2017 Paul Hudson https://www.hackingwithswift.com/favicon-96x96.png Swift Developer News - Hacking with Swift https://www.hackingwithswift.com/articles/rss Learn Core Graphics with Swift Playgrounds https://www.hackingwithswift.com/articles/123/learn-core-graphics-with-swift-playgrounds https://www.hackingwithswift.com/articles/123/learn-core-graphics-with-swift-playgrounds Take on a fundamental Apple API right on your iPad Sat, 16 Jun 2018 16:31:44 +0000 I just released my first ever playground book for Apple's Swift Playgrounds app on iPad: Learn Core Graphics. This gives you the ability to work through examples of drawing shapes, text, images, and more, all while seeing the results of your code played back right next to it.

The free book is structured as a series of challenges of increasing difficulties, and by the end you'll have learned a fair chunk of Core Graphics that you can then go on to apply elsewhere. Because it uses the real Core Graphics API rather than a simplified approach, you can literally take the code you wrote and apply it directly in your own iOS apps.

If this first book benefits enough people it's likely I'll do more in the future. So, give it a try and let me know what you think!

To learn more, and subscribe to the playground, go to this page on an iPad that has Swift Playgrounds installed: Hacking with Swift in Swift Playgrounds. You'll see a "Click to Subscribe" button there that only works on iPads with Swift Playgrounds installed, and it will subscribe you to my playgrounds feed.

Conference report: WWDC18 https://www.hackingwithswift.com/articles/122/conference-report-wwdc18 https://www.hackingwithswift.com/articles/122/conference-report-wwdc18 Our community’s biggest conference is over for another year Thu, 14 Jun 2018 06:10:32 +0000 Every year WWDC seems to grow bigger, and although 2018 didn’t provide the same astonishing new features we saw last year the event itself continues to be the greatest meetup of Apple developers in the world. You meet people you normally only see on Twitter, you get to ask questions to Apple developers who work on the frameworks you’re using, and you can meet a huge range of people at the many and varied social events in the evenings.

Let’s break it down…


By now you’ll have seen that the focus of WWDC this year is performance and stability, giving all of us a welcome break from the upgrade treadmill. That doesn’t mean it’s all quiet, though: new features in iOS 12 and macOS Mojave include Create ML, alert grouping, Siri Shortcuts, the Natural Language framework, and more.

Of all the new announcements, Siri Shortcuts is the one that has the power to change apps most dramatically. If you haven’t tried it out yet, Shortcuts allow you to direct the user to specific parts of your app based on custom voice commands. It’s not quite full Siri integration, but it’s a huge step forward and I’m looking forward to seeing what apps can do with it.

This year also saw the deprecation of UIWebView, which has served us well for over a decade. I know that WKWebView and SFSafariViewController provide full replacements these days, but I think we can all agree that UIWebView has served us well and deserves an honorable discharge from UIKit.


With slim pickings on the new feature front, it won’t be a surprise to hear that some of the major sessions – ARKit, and Core ML – were packed to overflowing, so you either started getting in line early or you didn’t get in.

On the flip side, a lack of new features meant Apple had to up its game a little: there was little scope for “introduction to…” talks because they had all been covered in previous years, so as a result there were many more advanced talks:...

What’s new in iOS 12? https://www.hackingwithswift.com/articles/121/whats-new-in-ios-12 https://www.hackingwithswift.com/articles/121/whats-new-in-ios-12 Learn what developer features have changed and how to use them Tue, 05 Jun 2018 06:58:07 +0000 iOS 12 brings with it huge leaps forward in machine learning, new ways to work with text, alert grouping so that users are bothered less frequently, and more. Part of this comes through huge improvements to Xcode, but I'll be covering it all here.

In this article I'm going to walk you through the major changes, complete with code examples, so you can try it all for yourself. Right now you can try iOS 12 only using the beta version of Xcode, and you will also need macOS Mojave if you want to use the new Create ML tools.


NEW: You can now pre-order my new book, Practical iOS 12! It's available at 50% off for the next few days, so be quick – click here to find out more!

Watch the video

If you prefer seeing these things like, I recorded a YouTube video showing of all the below and more.

Prefer reading instead? Then here we go…

Machine learning for image recognition

Machine learning (ML) was one of several major announcements from iOS 11, but it wasn't that easy to use – particularly for folks who hadn't studied the topic previously.

This is all changing now, because Apple introduced two important new pieces of functionality. The first – Create ML – is actually a macOS framework that's designed to make it trivial for anyone to create Core ML models to use in their app. The second – prediction batching – allows Core ML to evaluate many input sources in a more efficient way, making it less likely that newcomers would make basic mistakes.

Create ML has to seen to be ...

iOS 12.0 API Diffs https://www.hackingwithswift.com/articles/120/ios-12-api-diffs https://www.hackingwithswift.com/articles/120/ios-12-api-diffs Everything that has changed in one place Mon, 04 Jun 2018 21:59:12 +0000 div.api-diffs { margin-top: 30px; } div.api-diffs .a::before { content: "Added"; color: blue; font-size: 70%; font-style: italic; padding-left: 20px; } div.api-diffs .r::before { content: "Removed"; color: red; font-size: 70%; font-style: italic; padding-left: 20px; } div.api-diffs .m::before { content: "Modified"; color: green; font-size: 70%; font-style: italic; padding-left: 20px; } div.api-diffs code { color: black; background-color: inherit; font-size: 80%; font-family: monospace; } p.api-diffs-settings { text-align: center; } p.api-diffs-settings .btn-primary { background-color: #337ab7; border-color: #2e6da4; } .api-diff-hidden { display: none; } span.api-diff-summary { font-size: 80%; } h4 { color: #666666; } div.api-diff-file { margin-top: 40px; } div.api-diff-file:first-child { margin-top: 0; } div.api-diffs table { border: 1px solid #999999; margin-top: 5px; margin-bottom: 20px; margin-left: 40px; max-width: 90%; } div.api-diffs td { padding: 5px; border: 1px solid #999999; } div.api-diffs th { text-align: center; padding: 5px; background-color: #f0f0f0; border: 1px solid #999999; border-top: #999999; font-size: 70%; } div.api-diffs .table > tbody > tr > th { border-top: #999999; }