Hacking with Swift

7,954 阅读3分钟

Introduction to Swift

If you're just setting out on your Swift journey, you have a choice to make: would you like to start making apps now, or would you prefer some theory? Start reading here to choose your path.

Tutorial 1: Storm Viewer

Constants and variables, UITableView, UIImageView, NSFileManager, storyboards

Get started coding in Swift by making an image viewer app and learning key concepts.

Tutorial 2: Guess the Flag

Asset catalogs, UIButton, CALayer, UIColor, UIAlertController

Make a game using UIKit, and learn about integers, buttons, colors and actions.

Tutorial 3: Social Media

UIBarButtonItem, UIActivityViewController, NSURL

Let users share to Facebook and Twitter by modifying project 1.

Tutorial 4: Easy Browser

loadView(), WKWebView, NSURLRequest, UIToolbar, UIProgressView, key-value observing

Embed Web Kit and learn about delegation, KVO, classes and UIToolbar.

Tutorial 5: Word Scramble

NSString, closures, method return values, booleans, NSRange

Create an anagram game while learning about closures and booleans.

Tutorial 6: Auto Layout

Get to grips with Auto Layout using practical examples and code.

Tutorial 7: Whitehouse Petitions

JSON, NSData, UITabBarController

Make an app to parse Whitehouse petitions using JSON and a tab bar.

Tutorial 8: 7 Swifty Words

addTarget(), enumerate(), countElements(), find(), join(), property observers, range operators.

Build a word-guessing game and master strings once and for all.

Tutorial 9: Grand Central Dispatch

Learn how to run complex tasks in the background with GCD.

Tutorial 10: Names to Faces

UICollectionView, UIImagePickerController, NSUUID, classes.

Get started with UICollectionView and the photo library.

Tutorial 11: Pachinko

SpriteKit, physics, blend modes, radians, CGFloat, NSKeyedUnarchiver.

Dive into SpriteKit to try your hand at fast 2D games.

Tutorial 12: NSUserDefaults

NSUserDefaults, NSCoding, NSKeyedArchiver.

Learn how to save user settings and data for later use.

Tutorial 13: Instafilter

Core Image, UISlider, writing to the photo library.

Make a photo manipulation program using Core Image filters and a UISlider.

Tutorial 14: Whack-a-Penguin

SKCropNode, SKTexture, dispatch_after()

Build a game using SKCropNode and a sprinkling of Grand Central Dispatch.

Tutorial 15: Animation

Core Animation, CGAffineTransform.

Bring your interfaces to life with animation, and meet switch/case at the same time.

Tutorial 16: JavaScript Injection

Safari extensions, UITextView, NSNotificationCenter.

Extend Safari with a cool feature for JavaScript developers.

Tutorial 17: Swifty Ninja

SKShapeNode, AVAudioPlayer, UIBezierPath, custom enums

Learn to draw shapes in SpriteKit while making a fun and tense slicing game.

Tutorial 18: iAd and Debugging

iAd, println(), assert(), breakpoints.

A double bill of learning teaches you how to place adverts and debug your code.

Tutorial 19: Capital Cities

MKMapView, MKAnnotation, MKPinAnnotationView, CLLocationCoordinate2D.

Teach users about geography while you learn about MKMapView and annotations.

Tutorial 20: Fireworks Night

NSTimer, followPath(), sprite color blending, shake gesture.

Learn about timers and color blends while making things go bang!

Tutorial 21: Local Notifications

UILocalNotification.

Send reminders, prompts and alerts even when your app isn't running.

Tutorial 22: Detect-a-Beacon

CLLocationManager, CLBeaconRegion, CLProximity

Learn to find and range iBeacons using our first project for a physical device.

Tutorial 23: Space Race

Per-pixel collision detection, advancing particle systems, linear and angular damping.

Dodge space debris while you learn about per-pixel collision detection.

Tutorial 24: Swift Extensions

Language extensions, Swift playgrounds.

Try your hand at improving the built-in data types of Swift.

Tutorial 25: Selfie Share

Multipeer Connectivity Framework.

Make a multipeer photo sharing app in just 150 lines of code.

Tutorial 26: Marble Maze

Core Motion, collision bitmasks, array reversing, compiler directives.

Respond to device tilting by steering a ball around a vortex maze.

Tutorial 27: Core Graphics

Core Graphics.

Draw 2D shapes using Apple's high-speed drawing framework.

Tutorial 28: Secret Swift

Touch ID, device keychain.

Save user data securely using the device keychain and Touch ID.

Tutorial 29: Exploding Monkeys

Mixing UIKit and SpriteKit, texture atlases, scene transitions, destructible terrain.

Remake a classic DOS game and learn about destructible terrain and scene transitions.

Tutorial 30: Instruments

Profiling, shadows, image caching

Become a bug detective and track down lost memory, slow drawing and more.

Projects Level 2

Once you have completed all 30 Level 1 projects, you're ready for the all-new Level 2. These projects can be completed in any order you want. New projects are coming soon!

Tutorial 31: Multibrowser

UIStackView, iOS 9 multitasking for iPad, size classes

Get started with UIStackView and see just how easy iPad multitasking is in iOS 9.

Tutorial 32: SwiftSearcher

Core Spotlight, SFSafariViewController, NSAttributedString, Dynamic Type, automatic UITableViewCell sizing

Add your app's content to iOS 9's Spotlight search and take advantage of the new Safari integration.

Tutorial 33: What's that Whistle?

CloudKit, CKRecord, CKQuery, CKSubscription, AVAudioRecorder, and push messages

Build a crowd-sourced song recognition app using Apple's free platform as a service: CloudKit.

Tutorial 34: Four in a Row

GameplayKit, GKMinmaxStrategist, GKGameModel, UIStackView, map().

Let iOS take over the AI in your games using new iOS 9 GameplayKit features.

Tutorial 35: Generating random numbers

GameplayKit, GKRandomSource, GKARC4RandomSource, GKRandomDistribution, GKShuffledDistribution, GKGaussianDistribution.

The new iOS 9 GameplayKit lets you generate random numbers in ways you soon won't be able to live without.

Tutorial 36: Crashy Plane

SKAudioNode, GameplayKit randomization, and the guard keyword.

Ever wanted to make a Flappy Bird clone? Now you can do it in under an hour thanks to SpriteKit.

Articles

Articles are standalone pieces that explain individual concepts, without any sort of project attached. You can read them in whatever order you please

Free iOS 9 tutorials!

This brings together all my iOS 9 tutorials in one place, and it's the perfect way to get started with all the great new features announced by Apple.

What's new in iOS 9?

Learn about Core Spotlight, SFSafariViewController, GameplayKit, app thinning and much more.

What's new in Swift 2?

A brief overview of the key changes to Swift introduced at WWDC.

New features of Swift 2 by example

Try your hand at the new error checking, guard, defer and API availability checking.

Safari Content Blocking in iOS 9: a tutorial by example

How to write a content blocker extension in 10 minutes (and never see the Daily Mail again).