
Explore the Swift 4 cookbook's organized sections and learn iOS fixes—from particle emitters in a sprite kid game to loading data with the quotable protocol, and using accelerometer and sound.
Use fast enumeration to loop through an array in Swift, printing each item to the Xcode console, while reading items into a constant named item that should not be modified.
Explore how to shuffle an array on iOS 8 and below using a shuffle extension and the fisher gates shuffle algorithm, with example code and practical tips for game play.
Compute the Manhattan distance between two CGPoints on a grid with a dedicated function. Run the code to reveal the distance between the blue and red points.
Draw a square or rectangle with core graphics addRect by setting up a context and colors, producing a red square with a green border.
Render a pdf to an image using iOS built‑in drawing APIs, handling document size, background color, and orientation, via a pre-made method that returns a rendered image or nil.
Import game play kit and generate random numbers with GKRandomSource, producing values from roughly -2 billion to 2 billion, and use the upper-bound inclusive variant for 0 to 10.
Explore how to use GameplayKit's GKRandomDistribution to generate random numbers for virtual dice, including six- and twenty-sided dice, by importing GameplayKit and using a range constructor.
Learn to run SKActions in parallel with groups, then place the group in a sequence to ensure completion; a ship shrinks to 10% while fading over four seconds.
Learn to compare two tuples in Swift 2.2 using the comparison operator for up to six elements, and beware that tuple labels are not evaluated during comparison.
Convert a float to an int using the integer constructor. This operation rounds downward, as the example shows 10 rather than 11.
Explore converting a Swift string to NSString with a simple typecast, and highlight the ongoing interoperability between Swift strings and NSString.
Master Swift string interpellation to convert data types, including integers, to a string in one line. Use the string constructor as the more common alternative.
Drag in Objective-C code to your Swift project and configure an Objective-C bridging header to enable Swift to work with Objective-C code, adding the necessary import lines.
Learn how to find the minimum of two numbers in Swift 4, ensuring both integers or both floating point types, not mixed, with example code and using the main function.
Learn how lazy variables in Swift enable calculation of work, demonstrated with a person struct featuring an age property and a Fibonacci age property that computes only when requested.
Explore swift 1.2 changes that simplify optional handling with if let, remove the pyramid of doom, add optional and forced downcasting, new annotations, a set type, and incremental builds.
Explore swift 2.0 changes, including try-catch, guard for input and optionals, strings measured by characters, and the defer keyword. It adds mutability warnings and built-in api availability checks.
Swift 3.0 introduces major changes, including function parameters with labels, lower camel case, and method syntax updates; closures become non-escaping by default, and many foundation types convert to structures.
Explore closures as anonymous functions stored in a variable to be called later. They remember the program state and are used in UI view animations and completion blocks.
Explore the float datatype, which stores low precision decimal numbers such as 3.1 and 3.14159. Understand why Swift often defaults to double and when libraries use a C float instead.
Explore how storyboards organize iOS interfaces by using layout guides for alignment, linking multiple view controllers with segues, and choosing between visual navigation and programmatic creation.
Learn to implement an image picker using UIImagePickerController to select photos from the camera roll, request photo library permission, and handle selection, cancel actions, and privacy messages.
Learn to play sounds on iOS using AVAudioPlayer by storing the player as a property, locating the sound resource, creating the audio player, then playing or stopping safely with checks.
Save a rendered image to a file by converting it to png or jpeg data with UIImagePNGRepresentation or UIImageJPEGRepresentation. Save to the documents directory and verify in Finder.
If you're tired of scrolling through Stack Overflow trying to resuscitate ancient Swift 2.0 code, this is the perfect course for you: over 300 of the most common questions for Swift, iOS, and Xcode get answered right here, with all code fully updated for iOS 11 and Swift 4.
This is real, hands-on stuff that gets right to the point:
All those and more are covered right here, right before your eyes.
Organized for your convenience
With such a huge library of videos to learn from, you might be wondering how fast it can really be to find solutions inside this cookbook collection. Well, let me tell you: it's fast. The whole course is organized by segments such as CALayer, SpriteKit, and UIKit, so in one click you narrow your search down to what interests you most.
And from there you can either jump straight to the solution you care about – "how can I rotate my view?" – or just browse the category to stumble upon all-new things you haven't even tried before.
Tried and tested solutions
Anyone could put together some Swift code examples and call it a cookbook, but this collection is different.
First, this is the largest collection of its type in the world – with over 300 categorized solutions, this is a simply unbeatable problem-solving resource.
Second, this course comes with complete, downloadable source code for all solutions, so you can try them out easily.
Third, these solutions are proven: 10,000 students have already learned Swift from me, so I know the problems they hit time and time again. This course was crafted specifically to solve all the most common problems developers hit with UIKit, SpriteKit, Swift, and more.
But most importantly…
You're guaranteed incredible quality. No more scrabbling around Stack Overflow trying to find fixes, no more reading through ten pages of Google search results to find what you need.
Instead, the Swift 4 Cookbook gives you all the fixes you need to take your apps to the next level, all fully revised and updated for Swift 4 and iOS 11.