UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

That page doesn't exist, but based on searching the site here are some pages that might be what you're looking for…

How to benchmark app launch time using XCTOSSignpostMetric.applicationLaunch

Example Code Optimizing your application’s launch time helps ensure users spend more time using your app and less time staring at your launch screen, and helpfully Xcode comes with a built-in way to help us measure and monitor that time... Read more >>

Shipping a visionOS app for launch

Article We're now just a few days away from the launch of Apple Vision Pro, and like many other developers I've built and shipped a visionOS app ready for launch day. Doing this took quite a few steps, so I wanted to walk you through the whole process: coming up with ... Read more >>

Want to win the Swift Student Challenge? Previous WWDC scholars give their advice

Article ...e. Working in this area made me feel excited about WWDC where Apple would present all these new technologies, software and sometimes even products. Zach Simone: WWDC was an event that I'd followed from afar for many years. I was aware of the scholarship program, but hadn't really considered the possibility of applying. A ... Read more >>

Why many developers prefer Swift to Objective-C

Article ...pting (albeit not realistic). Lucas Farah: Hell? It was kinda easy to move back, but it is so ugly! I’m a freelancer, so sometimes I get Objective-c projects and it just make me wanna go back to Swift as soon as possible. Josh Adams: I maintain affection for Objective-C, a language I sometimes still encounter in the wor... Read more >>

The Complete Guide to Optionals in Swift

Article ...ap an optional that is empty, your app will crash immediately. It will just die, with no way to recover. As a result, ! is sometimes called the crash operator. Force unwraps are mainly used in two places: People are being lazy. I’m sorry that sounds hard, but it’s true: the overwhelming majority of force unwraps aren... Read more >>

What’s new in Xcode 13?

Article ...back its source editor issue reports. These are obviously very important and I rely on them dozens of times every day, but sometimes you know exactly what the problem is and the just kind of get in the way – sometimes they actually interfere with what you’re trying to do. Well, in Xcode 13 there’s a new way to show ... Read more >>

Interview: Dave Verwer

Article ...tions? “If you were working with clients it was almost impossible to manage their expectations.” Dave Verwer: It’s sometimes hard to remember how frustrating that delay was in the early years of the App Store. It wasn't even the length of the delay that was the main problem, it was more that you could wait one wee... Read more >>

Mixing UIKit and SpriteKit: UISlider and SKView

Project We've been mixing UIKit and SpriteKit ever since our first SpriteKit project, way back in project 11. Don't believe me? Look inside GameViewController.swift and you'll see a plain old UIViewController do all the work of loading and showing our GameScene code. There's a Main.storyboard file containing t... Read more >>

iPad multitasking

Project Although Multitasking is fairly recent in iOS, it’s already seen widespread adoption. This is partly because it’s so easy to do, but partly because users are asking for it so much. You'll be pleased to know that supporting multitasking is easy. In fact, it's so easy that our cur... Read more >>

How to create a custom Xcode template for coordinators

Article ...f you want. I don’t know about you, but I have a complicated relationship with storyboards: I recognize their usefulness sometimes, but I also like to write UI in code when it makes sense, and I certainly don’t want to use segues that force my application flow to be baked into my UI design. When using coordinators, th... Read more >>

How to run code when your app is terminated

Example Code If you need to execute code when your app isn’t running, there are several options open to you depending on what you’re trying to do. Background fetch will let your app run in the background for about 30 seconds at scheduled intervals. The goal of this is to fetch data and pr... Read more >>

How to install Xcode and create a playground

Project ...You don’t build real apps with them, but they are great for learning. We’ll be using playgrounds in this introduction. Crashes are when your code goes disastrously wrong and your app cannot recover. If a user is running your app it will just disappear and they’ll be back on the home screen. If you're running in Xcod... Read more >>

Interview: Tanner Nelson

Article With the release of Swift 4.1, work on Vapor 3 is finally on the verge of being complete and the team are busy tagging all the Vapor repositories for the 3.0 release. Vapor 3 changes a huge amount from Vapor 2, so I sat down with Tanner... Read more >>

WWDC22: Wrap up and recommended talks

Article ...e’s home in Cupertino to share their excitement, meet engineers, and even have tours around Apple Park. Of course, the conference was also available remotely, with digital lounges returning, labs available for everyone, and lots of community events. In this article I’ll go over how I think the event went, pick out th... Read more >>

UIActivityViewController explained

Project ...e, shareTapped() can send photos via AirDrop, post to Twitter, and much more. You have to admit, iOS can be pretty amazing sometimes! A lot of that code is old; we already learned about present() in project 2. However, some other parts are new, so let me explain what they do: We start with the method name, marked with @... Read more >>

Understanding threads and queues

Example Code ...y: we create a queue and add work to it, and the system will remove and execute work from there in the order it was added. Sometimes the queues are serial, which means they remove one piece of work from the front of the queue and complete it before going onto the next piece of work; and sometimes they are concurrent, whic... Read more >>

Interview: Erica Sadun

Article ... a significant and positive impact. With other proposals, I am happy that the subject was aired and voted on and put away. Sometimes you have to champion an idea that won't die so it will be properly debated and gently laid to rest. I'd say that many of my proposals are utility ones, that simply formalized where the langu... Read more >>

Codable cheat sheet

Article ....keyDecodingStrategy = .convertFromSnakeCase decoder.dateDecodingStrategy = .formatted(formatter) Working with weird dates Sometimes you’ll get dates so strange that even DateFormatter can’t handle them. For example, you might get JSON that stores dates using the number of days that have elapsed since January 1st 1970... Read more >>

Year in review: 2019

Article ...orms as I’m trying things that have my brain excited and as connections jump out at me. These things keep me up at night sometimes: if I try to sleep without writing them down my brain just stays in gear, developing it more and more. The only solution I have is to write down my ideas, save my code somewhere safe, then c... Read more >>

The Complete Guide to iOS and Swift Job Interviews

Article ...e a mistake, or missed something off, I can pretty much guarantee folks will tell you – we’re a pretty pedantic bunch sometimes! While it’s true that some folks will be negative, I think you’ll find most are positive and want to help you do better next time. As for releasing code on GitHub, this is more difficult... Read more >>

What's new in Swift 5.5?

Article ...) print("Server response: \(response)") } As you can see, all the closures and indenting have gone, making for what is sometimes called “straight-line code” – apart from the await keywords, it looks just like synchronous code. There are some straightforward, specific rules about the way async functions work: Sy... Read more >>

How to test your user interface using Xcode

Article ...pgrade it so you can see exactly how the process work. The project we’ll be using is a simple sandbox with a variety of controls – you can download it here. Give the example app a try now – it’s a simple sandbox app with a small amount of functionality: If you enter text into the text box you’ll see the same ... Read more >>

How to streamline your development with Fastlane

Article Part 4 in a series of tutorials on modern app infrastructure: How to refactor your code to add tests How to add CocoaPods to your project How to clean up your code formatting with SwiftLint How to streamline your development with F... Read more >>

Optional chaining

Project Working with optionals can feel a bit clumsy sometimes, and all the unwrapping and checking can become so onerous that you might be tempted to throw some exclamation marks to force unwrap stuff so you can get on with work. Be careful, though: if... Read more >>

Implicitly unwrapped optionals

Tutorial ... use them and they have no value – if they are nil – your code crashes. Implicitly unwrapped optionals exist because sometimes a variable will start life as nil, but will always have a value before you need to use it. Because you know they will have a value by the time you need them, it’s helpful not having to wri... Read more >>

Debugging with assert()

Project ...tion isn't true. On the surface, that sounds terrible: why would you want your app to crash? There are two reasons. First, sometimes making your app crash is the Least Bad Option: if something has gone catastrophically wrong – if some fundamentally important file is not where it should be – then it may be the case tha... Read more >>

Learn SwiftUI with SwiftUI By Example

Article Many people are keen to learn SwiftUI in the fastest way possible, which is why I wrote SwiftUI By Example: a comprehensive, free collection of example code that helps you get started with SwiftUI today. Not only does SwiftUI By Example walk you through well over 100 common coding problems and solutions, but it also provides a hands-on ... Read more >>

Improving your Swift code using value objects

Article ...alue)") } } } This at least makes it easier to write user creation tests, without running the risk of surprise crashes in production. Where now? As you’ve seen, value objects help us write simpler, safer code by taking the immutability and natural equatability of value types and adding the ability to self-v... Read more >>

How to remove the first or last item from an array

Example Code ...() returns an optional – if the array was empty, you get back nil. If you call removeLast() on an empty array, your app crashes. So, in this example last1 will contain 5 and last2 will contain 4: var numbers = [1, 2, 3, 4, 5] let last1 = numbers.popLast() let last2 = numbers.removeLast() As for removing items from the ... Read more >>

When is it safe to force unwrap optionals?

Example Code ... identifier. Apple’s API here doesn’t throw errors, and doesn’t return an optional view controller – it just hard crashes, because there’s no sensible way for the app to continue if it’s missing a whole storyboard identifier. You can apply that same logic to your code: if you’re trying to load a UIImage fro... Read more >>

Conditional conformances

Article ...me because Person doesn’t conform to Codable. Obviously no one wants a fatal error at runtime, because it means your app crashes. Fortunately, Swift 4.1 cleans this up using conditional conformances: Optional, Array, Dictionary, and Set now only conform to Codable if their contents also conform to Codable, so the above code will refuse to compile. Read more >>

Continuations for interfacing async tasks with synchronous code

Article ...ikely people will use withCheckedContinuation() while writing their functions so Swift will emit warnings and even trigger crashes if the continuations are used incorrectly, but some may then switch over to withUnsafeContinuation() as they prepare to ship if they are affected by the runtime performance cost of checked continuations. Read more >>

How to create exception breakpoints in Xcode

Example Code ...er to pause whenever a problem is encountered anywhere in your program, so you can evaluate your program's state before it crashes. Exception breakpoints are trivial to set up: go to the Breakpoint Navigation (Cmd+7), then click the + button in the bottom left and choose Add Exception Breakpoint. You can leave it there if... Read more >>

Arrays

Tutorial ...ray positions count from 0, so if you want to read “Paul McCartney” you would write this: beatles[1] Be careful: Swift crashes if you read an item that doesn’t exist. For example, trying to read beatles[9] is a bad idea. Note: If you’re using type annotations, arrays are written in brackets: [String], [Int], [Double], and [Bool]. Read more >>

What’s new in Swift 4.1

Article ...me because Person doesn’t conform to Codable. Obviously no one wants a fatal error at runtime, because it means your app crashes. Fortunately, Swift 4.1 cleans this up using conditional conformances: Optional, Array, Dictionary, and Set now only conform to Codable if their contents also conform to Codable, so the above ... Read more >>

How to create popover menus using UIPopoverPresentationController

Example Code ...sed, whereas on iPad it could be shown from anywhere. In fact, if you just try and show one on an iPad like this, your app crashes: let ac = UIAlertController(title: "Hello!", message: "This is a test.", preferredStyle: .actionSheet) present(ac, animated: true) The solution is to use a UIPopoverPresentationController, whi... Read more >>

How to implement singletons in Swift the smart way

Article ... UIDevice, WCSession, and many more all use singletons. Heck, trying to instantiate an instance of UIApplication literally crashes your code because it doesn’t make sense to do such a thing. Instead, an application is created for you and you get access to that shared instance – all access to its methods and propertie... Read more >>

10 Quick Swift Tips

Article ...e. For example, this code compile fine then crash at runtime: let highScore = Int8.max let newHighScore = highScore + 1 It crashes because it tries to increment Int8.max by 1, making 128, which is beyond the scope of what Int8 can store. Even though crashing sounds bad, it’s often safer than other alternatives. However,... Read more >>

Customizing our filter using confirmationDialog()

Project ...which provides no safety at all. In this case, the Gaussian Blur filter doesn’t have an intensity value, so the app just crashes. To fix this – and also to make our single slider do much more work – we’re going to add some more code that reads all the valid keys we can use with setValue(_:forKey:), and only sets ... Read more >>

How to render UIViews in 3D using CATransformLayer

Article ...eople BIKESHED proposals while Swift itself still hasn't finished compiling code written during the OLD REPUBLIC.\n\nXCODE crashes faster than a speeder bike on Endor, but undeterred Apple unleashed a new wave of Auto Layout problems with THE NOTCH.\n\nMeanwhile, the GALACTIC EMPI — er, GOOGLE — are building an army ... Read more >>

What are we working with?

Project ... fixable!) in Swift code. And how bad are the problems? Well, if you run the app on a device, you'll probably find that it crashes after you’ve viewed several pictures – on my iPhone I get about two-thirds of the way through before it gives up. You might also notice that scrolling isn’t smooth in the table view, par... Read more >>

Why does SwiftUI use structs for views?

Project ... whether they need them or not. Tip: If you use a class for your view you might find your code either doesn’t compile or crashes at runtime. Trust me on this: use a struct. Read more >>

Conference report: 2018

Article ...t the clicker I was using wasn’t great: I’d press the advance button and nothing would happen, then press it again and sometimes even have it advance twice. When you’ve worked so hard on such a short presentation, every click counts, so this wasn’t ideal. However, lesson learned: I bought my own clicker in the for... Read more >>

How to organize a great programming conference

Article ...pick, especially when the only thing you know about the person is a quick bio or what they writes on the Twitter feed. So, sometimes it’s really easy just to pick someone that already gave that talk at another conference. Appdevcon: In our opinion a great proposal is brief (since we have to review many), but still very ... Read more >>

Interview: Carola Nitz

Article ...t’s pretty much up to the developing team and we discuss possible features when we get together. Other functionality is sometimes the result of client work, when we see that a certain number of people is missing functionality, we build it for them but then make it part of the core. Luckily, since I work on open source ... Read more >>

Formatting our mission view

Project Now that we have all our data in place, we can look at the design for our first screen: a grid of all the missions, next to their mission badges. The assets we added earlier contain pictures named “apollo1@2x.png” and similar, which means they are accessible in the asset catalog as “apollo1”, “apoll... Read more >>

Ready... aim... fire: Timer and follow()

Project To get the game up and running quickly, we're going to work on the three methods required to launch some fireworks: didMove(to:) will create a timer that launches fireworks every six seconds, createFirework() will create precisely one firework at a specific po... Read more >>

Xcode UI Testing Cheat Sheet

Article User interface testing is the ultimate integration test, because you’re seeing the app exactly how users do – there’s no special internal knowledge of how your code is structured as we get with unit tests, and you can’t add mocks or stubs ... Read more >>

How to delete a Core Data object

Project Table views have a built-in swipe to delete mechanic that we can draw upon to let users delete commits in our app. Helpfully, managed object context has a matching delete() method that will delete any object regardless of its type or location in the object graph. Once an ... Read more >>

Year in review: 2018

Article This has been a really busy year for me, but most of the time I’m too busy working on stuff and planning what’s next to actually look back and see how far I’ve come. So, in this end of year blog post I want to look back over the last 12 months: what I worked on and why, what wa... Read more >>

How to adopt iOS 11 user interface changes in your app

Article ...ur app to look and feel part of the new iOS design language you’ll need to start making a few changes now: large navigation titles, better use of safe edges, improved table view swipe actions, and more. Note: this article is an excerpt from my book Practical iOS 11. Large navigation titles First and most significantly a... Read more >>

Fixing the bugs: wasted allocations

Project Back in Xcode, press Cmd+I to launch a fresh instance of Instruments, and this time I want you to choose the Allocations instrument. This tells you how many objects you're creating and what happens to them. Press record, then scroll around the table view a few times to get a complete picture of the app running. At t... Read more >>

What’s new in Vapor 3?

Article ...esult, you might find you have to use flatMap() multiple times. However, Vapor provides some helper functionality that can sometimes help reduce the complexity, and it’s a good idea to lean on them as much as you can if you want to keep your code clean. You can return futures directly from routes. Vapor will automatica... Read more >>

We need to talk about Swift’s diversity problem

Article It’s no secret that I love Swift: I’ve written over a dozen books about it, I speak at conferences around the world, and use it for all my own apps. But as incredible as the language is, we as a community continue to have a deep-seated diversity problem, and we need to take more steps to... Read more >>

Debugging Auto Layout feedback loops

Article This article is dedicated to Marian Goldeen and Russell Ladd, who work tirelessly to help all of us build great apps. A while ago, Tyler Fox mentioned Auto Layout’s feedback loop debugger on Twitter, which was a feature announced back in WWDC 2016 but largely seems to have gone unnoticed since. Apple certainly weren’t trying to hide it –?... Read more >>

How to find and fix slow code using Instruments

Article Part 3 in a series of tutorials on Instruments: How to find and fix slow drawing using Instruments How to find and fix memory leaks using Instruments How to find and fix slow code using Instruments Previously we’ve seen how Ins... Read more >>

Using generics to load any kind of Codable data

Project We added a Bundle extension for loading one specific type of JSON data from our app bundle, but now we have a second type: missions.json. This contains slightly more complex JSON: Every mission has an ID number, which means ... Read more >>

How to use the coordinator pattern in iOS apps

Article Using the coordinator pattern in iOS apps lets us remove the job of app navigation from our view controllers, helping make them more manageable and more reusable, while also letting us adjust our app's flow whenever we need. This is part 1 in a series of tutorials on fixing massi... Read more >>

Unleash the bananas: SpriteKit texture atlases

Project ...nd name it "player1". Create a physics body for the player that collides with bananas, and set it to not be dynamic. Position the player at the top of the second building in the array. (This is why we needed to keep an array of the buildings.) Add the player to the scene. Repeat all the above for player 2, except they sho... Read more >>

Super-powered string interpolation in Swift 5.0

Article ...eate types in a really natural way. Remember, this is only one tool in our toolbox – it's not our only tool. That means sometimes you'll use interpolation, other times functions, and other times something else. Like many things in programming, the key is to be pragmatic: to make choices on a case-by-case basis. At the ... Read more >>

Interview: Guilherme Rambo

Article ...e Watch stand notifications can be very helpful in those situations. I try to document things as much as possible, because sometimes I’ll find something and have an idea of what it can be, but not have enough material to actually find out for sure and run a story. In those cases, I write down what I found, where I found... Read more >>

Communicating between iOS and watchOS: WCSession

Project It's time for something new, and something I've held back from covering in Hacking with Swift because only a small proportion of people have an Apple Watch. So, I'm covering it here only briefly, and only at the very end of the project so that if you don't have an Apple Watch you can just skip on past... Read more >>

Xcode 10 wish list: native iOS support, codegen, and more

Article Xcode 9 was released on the Mac App Store a few hours ago, and there’s no doubt it’s the most feature-packed Xcode release to date. Not only does it include faster editing, named colors, Swift refactoring, and wireles... Read more >>

Top Swift and iOS Conferences in 2018

Article Conferences are always a great way to discover new techniques, be inspired by great talks, and meet like-minded developers. Fortunately, there are some amazing conferences taking place around the world... Read more >>

Want to learn Vapor 3? Start here.

Article I’ve been using Vapor 3 since its earliest betas back in November 2017, and over the months since then I’ve worked hard to write and update my Vapor 3 book to make sure it covers all the latest techniques and APIs to help you make the most of server-side Swift. Well, now that Swift 4... Read more >>

How to use Result in Swift

Article SE-0235 introduced a Result type into the standard library, giving us a simpler, clearer way of handling errors in complex code such as asynchronous APIs. This is something folks have been asking for since the very earliest days of Swift, so it's great to see it finally arrived in Swift 5! Swift’s Result type is implemented as an enum that... Read more >>

The Best Swift and iOS conferences in 2019

Article The iOS community is lucky enough to have a great number of conferences held around the world every year, so no matter where you live there should be something only a short distance away. Of course, if you’d prefer to travel somewhere fun to learn Swift, that... Read more >>

WWDC21: Wrap up and recommended talks

Article ...me time, I think Apple’s digital lounges have shown enough promise that they deserve the chance to grow and evolve. Yes, sometimes they were locked down within an inch of their existence, and yes that existence was terminated abruptly after the event ended, but it still helped engage folks at a global scale that an in-p... Read more >>

How to make Xcode take up less space

Article We all know that Xcode has struggled with being a little on the portly side for some years, and even Apple acknowledged this back at WWDC 2012. Here’s what Matthew Firlik (Director of Development Technologies at Apple) had to say at the time: Last year [... Read more >>

Why many developers still prefer Objective-C to Swift

Article For several years after the iOS SDK was announced, developers were flocking to Objective-C as they sought to get their slice of the app development gold rush. But those times are gone: Swift has been with us for over three years now, and has largely pushed its older sibling from the limelight. Objective-C – once the rising star of the app development world – has started t... Read more >>

How to save and share your work with GitHub

Article Part 5 in a series of tutorials on modern app infrastructure: How to refactor your code to add tests How to add CocoaPods to your project How to clean up your code formatting with SwiftLint How to streamline your development with F... Read more >>

Setting up

Project As I write these initial words, I already know this is going to be one of the most expansive and useful Hacking with Swift tutorials to date. We're going to be using CloudKit to load and save user data, we'll read from the microphone using AVAudioRecorder, we'll add ... Read more >>

What’s new in Swift 5.1

Article ...ways need to return the same type, why not just write the function as func launchFighter() -> XWing? While that might work sometimes, it creates new problems such as: We end up with types we don’t really want to expose to the world. For example, if we used someArray.lazy.drop { … } we get sent back a LazyDropWhileSe... Read more >>

How to use opaque return types in Swift

Article ...ways need to return the same type, why not just write the function as func launchFighter() -> XWing? While that might work sometimes, it creates new problems such as: We end up with types we don’t really want to expose to the world. For example, if we used someArray.lazy.drop { … } we get sent back a LazyDropWhileSe... Read more >>

Opaque return types

Article ...ways need to return the same type, why not just write the function as func launchFighter() -> XWing? While that might work sometimes, it creates new problems such as: We end up with types we don’t really want to expose to the world. For example, if we used someArray.lazy.drop { … } we get sent back a LazyDropWhileSeq... Read more >>

Build a unit converter for watchOS

Article ...ed space I think medium works best. Second, pickers will automatically choose their first item as their default selection. Sometimes that’s OK, but because we’re loading the same list of units into each picker it looks a bit silly – it will try to convert Hours to Hours, or Grams to Grams, for example. To fix this, ... Read more >>

How to Become an iOS Developer in 2021

Article ...uring your code to make it easier to read, easier to use, easier to modify, and easier to take care of in the longer term. Sometimes these techniques rely on the way Swift works – language features you can use to write better code. But there are many more techniques that work in any programming language, and we usually ... Read more >>

How to fix slow List updates in SwiftUI

Article If you have a SwiftUI list with lots of rows, you might find it's really slow to update when you sort or filter those rows – code that should run instantly might take one or two seconds, or if you have lots of items one or two minutes. Note: This fix is no longer required; Apple resolved this issue in iOS 14. I'm going to show you what code causes the problem, then... Read more >>

Year in review: 2020

Article What the heck just happened? ? Many people – myself included – had big plans for the year. I wanted to work more on my open source software (Unwrap, Control Room, Sitrep, and more), I wanted to update a whole collection of books to be more focused on SwiftUI, I wanted to write new, shorter books to go alongside ... Read more >>

Setting up

Project In this project you'll produce an application that lets users scroll through a list of images, then select one to view. It's deliberately simple, because there are many other things you'll need to learn along the way, so strap yourself in – ... Read more >>

Apple's SPMUtility library will power up command-line apps

Article Apple has unveiled a new collection of open-source utility code for Swift developers, grown out of its Swift Package Manager project. The collection contains some interesting new data types (OrderedSet – hurray!), some tools to ma... Read more >>

Exiting loops

Tutorial ...ountDown = 10 while countDown >= 0 { print(countDown) countDown -= 1 } print("Blast off!") In this case, the astronaut in command gets bored part-way through the countdown and decides to skip the remainder and launch straight away: while countDown >= 0 { print(countDown) if countDown == 4 { prin... Read more >>

How to run code when your app launches

Example Code When you’re using the SwiftUI App life cycle, your app launches through one struct that conforms to the App protocol. Its job is to create your initial view using either WindowGroup, DocumentGroup, or similar, but because its created before any of your actual views this i... Read more >>

Acting on responses

Project There’s a lot more you can do with notifications, but chances are the thing you most want to do is act on the user’s response – to show one or more options alongside your alert, then respond to the user’s choice. We already set the categor... Read more >>

How to save user settings using UserDefaults

Example Code All iOS apps have a built in data dictionary that stores small amounts of user settings for as long as the app is installed. This system, called UserDefaults can save integers, booleans, strings, arrays, dictionaries, dates and more, but y... Read more >>

How to install a beta version of Swift

Example Code Xcode ships with a fixed version of Swift, but that doesn't mean you need to use that version. In fact, it's possible to install multiple versions of the Swift toolchain, and switch between them as often as you need. At the time o... Read more >>

How to use SFSafariViewController to show web pages in your app

Example Code If a user clicks a web link in your app, you used to have two options before iOS 9.0 came along: exit your app and launch the web page in Safari, or bring up a new web view controller that you've designed, along with various user interface controls. Exiting your app... Read more >>

How to add Core Spotlight to index your app content

Project One of the most important additions in iOS 9 was the ability for apps to communicate bidirectionally with Spotlight, the iOS system-wide search feature. What this means is that apps can ask for their ... Read more >>

Interview: Antoine van der Lee

Article ... on optimizing our CI runs as much as possible. Therefore, we’re not using UI tests as they’re still pretty slow. This sometimes means that we need to do a hotfix for a broken UI, but this is something we accept doing. We’re also running all our unit tests offline, using our open-sourced framework Mocker. This speed... Read more >>

Transforming shapes using CGAffineTransform and even-odd fills

Project ...ge we can go from interesting to sublime. If you look at the way our ellipses are being drawn, they overlap frequently – sometimes one ellipse is drawn over another, and sometimes over several others. If we fill our path using a solid color, we get a fairly unimpressive result. Try it like this: Flower(petalOffset: peta... Read more >>

About this course

Tutorial ...me material so you’re welcome to learn whichever way suits you best. If you’re using the videos you’ll notice that I sometimes introduce topics using slides and sometimes demonstrate them in Xcode. It might feel repetitive, but it’s intentional – there’s a lot of things to learn, and if you saw each one only ... Read more >>

Using two-cased enums in place of a Boolean

Article ...d error – I tried both to see what felt good, and what I found is that correct and incorrect are visually so close that sometimes I was misreading lines. But why bother? Admit it: this is the question you’ve been asking since you started reading. After all, Booleans sort of already are two-cased enums – they can b... Read more >>

8 Things I Wish I Knew When I Started Programming

Article ...u might think this is a downside, but honestly constant learning is half the reason our job is so much fun: every year – sometimes every month! – something amazing happens in our industry, and you need to keep upgrading your skillset to stay on top of it all. It’s hugely exciting, and it’s important you learn to ... Read more >>

Key points

Guide ...ift won’t let you touch optionals if they are nil, unless you specifically force override it – there’s a reason ! is sometimes called “the crash operator”. When you use a switch/case block, it must be exhaustive – it must cover all possible cases. Let’s take another look at some optional code. Consider this... Read more >>

Building a detail screen

Project ... lowercase letter, then use a capital letter at the start of any subsequent words. For example, myAwesomeVariable. This is sometimes called camel case. UIImageView!: This declares the property to be of type UIImageView, and again we see the implicitly unwrapped optional symbol: !. This means that that UIImageView may be t... Read more >>

Get started with Vapor 3 for free

Article ...: I’ve modified the closure signature so that it accepts a request and explicitly returns a Message instance. Swift can sometimes figure out the return type for you, but it’s usually best to be explicit. The new Message instance is created with a random identifier generated by a new UUID instance, and the current dat... Read more >>

How to read Apple’s developer documentation

Article ...?they return an optional so that they can send back nil if initialization failed. Directly below the initializers you will sometimes see some methods for creating highly specialized instances of the class. These aren’t initializers in the Swift sense, but they do create instances of the class. For UIImage you’ll see t... Read more >>

How to create and run a task

Example Code Swift’s Task struct lets us start running some work immediately, and optionally wait for the result to be returned. And it is optional: sometimes you don’t care about the result of the task, or sometimes the task automatically updates some external value when it completes, so you can just use them as “fire and forget” operations... Read more >>

User interface testing with XCTest

Project ...o; second, it still doesn't know what a pass or fail looks like, so you need to add your own assertions at the end; third, sometimes it won't even write valid code, although recent Xcode versions have reduced the chance of that happening. So, it's a long way from perfect, but it does at least give you something to start w... Read more >>

Apple, can we please talk about your documentation?

Article ...aking documentation more seriously than the documentation side of Apple, which is a remarkable situation to be in. Fourth, sometimes Apple does get documentation right: I’ve called out instances in the past where Apple’s documentation has been comprehensive and it’s made a huge difference – the Touch Bar docs wer... Read more >>

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.