Introduction - How to use the Cookbook
  • Introduction - How to use the Cookbook
Arrays
  • How do you create multi-dimensional arrays?
  • How to count objects in a set using NSCountedSet
  • How to enumerate items in an array
  • How to find an item in an array using indexOf()
  • How to join an array of strings into a single string
  • How to loop through items in an array
  • How to loop through an array in reverse
  • How to shuffle an array in iOS 8 and below
  • How to shuffle an array using GameplayKit
  • How to sort an array using sort()
  • How to tell if an array contains an object
CALayer
  • How to add a border outline color to a UIView
  • How to create keyFrame animations using CAKeyFrameAnimation
  • How to draw color gradients using CAGradientLayer
  • How to draw shapes using CAShapeLayer
  • How to emit particles using CAEmitterLayer
  • How to round the corners of a UIView
Core Graphics
  • How to calculate the distance between two CGPoints
  • How to calculate the Manhattan distance between two CGPoints
  • How to compare two CGRects with equalTo()
  • How to draw a circle using Core Graphics: addEllipse(in:)
  • How to draw a square using Core Graphics - addRect()
  • How to draw a text string using Core Graphics
  • How to draw lines in Core Graphics - move(to) and addLine(to)
  • How to find a scale from a CGAffineTransform
  • How to find the rotation from a CGAffineTransform
  • How to find the translation from a CGAffineTransform
  • How to render a PDF to an image
  • How to use Core Graphics blend modes to draw a UIImage differently
Games
  • How to add physics to an SKSpriteNode
  • How to add pixel-perfect physics to an SKSpriteNode
  • How to change SKScene with a transition - presentScene()
  • How to color an SKSpriteNode using colorBlendFactor
  • How to create 3D audio sound using SKAudioNode
  • How to create a SpriteKit texture atlas in Xcode
  • How to create shapes using SKShapeNode
  • How to emit particles using SKEmitterNode
  • How to find a touch's location in a node using location(in-)
  • How to generate a random number with GKRandomSource
  • How to roll a dice using GameplayKit and GKRandomDistribution
  • How to run SKActions in a group
  • How to run SKActions in a sequence
  • How to stop an SKPhysicsBody responding to physics using its dynamic property
  • How to write text using SKLabelNode
Language
  • Fixing "Ambiguous reference to member when using ceil or round"
  • Fixing "Class ViewController has no initializers"
  • How to check for valid method input using the guard keyword
  • How to check the Swift version at compile time
  • How to compare two tuples for equality
  • How to convert a float to a CGFloat
  • How to convert a float to an int
  • How to convert a string to a double
  • How to convert a string to a float
  • How to convert a string to an int
  • How to convert a string to an NSString
  • How to convert an int to a float
  • How to convert an int to a string
  • How to convert an NSRange to a Swift string index
  • How to create an Objective-C bridging header to use code in Swift
  • How to create multi line stirng literals
  • How to delay execution of code using the defer keyword
  • How to find the maximum of three numbers
  • How to find the maximum of two numbers
  • How to find the minimum of three numbers
  • How to find the minimum of two numbers
  • How to fix “argument of #selector refers to instance method that is not exposed
  • How to force your program to crash with assert()
  • How to install a beta version of Swift
  • How to print debug text in Swift
  • How to unwrap an optional in Swift
  • How to use Codable to load and save custom data types
  • How to use compiler directives to detect the iOS simulator
  • How to use the try/catch in Swift to handle exceptions
  • How to use #available to check for API availability
  • Tips for android developers switching to Swift
  • Using stride() to loop over a range of numbers
  • What are lazy variables?
  • What are property observers?
  • What are the changes in Swift 1.2
  • What are the changes in Swift 2.0
  • What are the changes in Swift 2.2
  • What are the changes in Swift 3.0
  • What does an exclamation mark mean?
  • What does override mean?
  • What does unowned mean?
  • What does weak mean?
  • What is a CGFloat?
  • What is a closure?
  • What is a delegate in iOS?
  • What is a dictionary?
  • What is a double?
  • What is a float?
  • What is a nib?