Book description
Swift Recipes provides a problem solution approach for dealing with key aspects of the Swift programming language (covering version 1.2), ensuring you have the indispensable reference you need to successfully execute common programming tasks. You’ll learn how to use the unique features of the Swift programming language as well as its use with Cocoa and Cocoa touch frameworks and libraries.
Solutions are available for a range of problems, including application development with Xcode; working with strings, numbers, and object collections; dealing with threads, multi-core processing, and asynchronous processing; and building applications that take advantage of dates and timers and memory management.
This book is an essential core reference for every Swift programmer and offers solutions in a concise and easy-to-follow manner. T. Michael Rogers has developed iOS applications for Fortune 100 brands and startups, and has trained new and experienced iOS developers via the iOS Boot Camp in New York City, online courses, and in private settings. He brings his expertise to offer you the ability to use and exploit Swift to get the most out of all your projects for your app creations, whether you use iOS or Mac OS X.
Table of contents
- Cover
- Title
- Copyright
- Dedication
- Contents at a Glance
- Contents
- About the Author
- About the Technical Reviewer
- Acknowledgments
- Introduction
-
Chapter 1: Swift Programming
- 1-1. Getting Started with Swift
- 1-2. Installing Xcode 6
- 1-3. Working with Playgrounds
- 1-4. Designing User Interface Elements in a Storyboard
- 1-5. Dealing with Strings
- 1-6. Formatting Numbers as Strings
- 1-7. Getting the Length of a Swift String
- 1-8. Manipulating Swift Strings
- 1-9. Manipulating Strings with Native Swift Methods
- 1-10. Storing Strings on the iOS File System
- 1-11. Reading a Text File into a String
- 1-12. Reading and Writing Text Files in Cocoa
- 1-13. Dealing with Numbers
- 1-14. Dealing with Dates
- Chapter 2: Complex Types
-
Chapter 3: Collections
- 3-1. Creating an Array
- 3-2. Counting the Number of Items in an Array
- 3-3. Managing Items in an Array
- 3-4. Searching for Items in an Array
- 3-5. Sorting an Array
- 3-6. Replacing a Range of Values in an Array
- 3-7. Iterating Over an Array
- 3-8. Saving an Array to the File System
- 3-9. Populating an Array with the Contents of a plist File
- 3-10. Using Subscripts
- 3-11. Creating a Dictionary
- 3-12. Managing Items in a Dictionary
- 3-13. Implementing the Hashable Protocol
- 3-14. Iterating Through Items in a Dictionary
- 3-15. Saving a Dictionary to the File System
- 3-16. Populating a Dictionary with the Contents of a Property List File
-
Chapter 4: Advanced Swift Programming
- 4-1. Writing Closures
- 4-2. Writing Trailing Closures
- 4-3. Overloading the Equality Operator
- 4-4. Checking for Reference Equality
- 4-5. Implementing Generic Functions
- 4-6. Implementing Generic Classes
- 4-7. Working with Local Dates and Times
- 4-8. Creating a Unit Test Project
- 4-9. Writing a Unit Test
- 4-10. Performance Testing with XCTest
- 4-11. Creating Mock Objects for Testing
- 4-12. Testing Asynchronous Code
-
Chapter 5: iOS Applications
- 5-1. Creating a New iOS Application
- 5-2. Adding a UILabel to a View
- 5-3. Adding a UIButton to a View
- 5-4. Adding a UITextField to a View
- 5-5. Positioning UIViews in Auto Layout Using NSConstraints
- 5-6. Repositioning a View to Accommodate the Keyboard
- 5-7. Displaying an Alert with UIAlertController
- 5-8. Using UIAlertController to Collect User Input
- 5-9. Creating a UITableView
- 5-10. Swiping to Delete an Item from a UITableView
-
Chapter 6: OS X Applications
- 6-1. Creating an OS X Application
- 6-2. Adding a View to a Window
- 6-3. Adding a Menu and Menu Items
- 6-4. Adding a Button to a Window
- 6-5. Using an NSTextField
- 6-6. Displaying an Image in a Window
- 6-7. Adjusting Contents When a Window Is Resized
- 6-8. Implementing an NSTableView
- 6-9. Sorting an NSTableView
- 6-10. Handling the Selection of an NSTableView Row
- Chapter 7: Files and Directories
- Chapter 8: Concurrency
- Chapter 9: Web Services
-
Chapter 10: Core Data
- 10-1. Creating a Data Model
- 10-2. Creating Model Classes
- 10-3. Creating a Data Store
- 10-4. Creating a Managed Object Context
- 10-5. Adding a New Entity
- 10-6. Creating an NSFetchRequest
- 10-7. Populating a UITableView with a Fetched Results Controller
- 10-8. Deleting an Item
- 10-9. Searching for Entities
- Chapter 11: Advanced iOS 8 Features
- Index
Product information
- Title: Swift Recipes: A Problem-Solution Approach
- Author(s):
- Release date: July 2015
- Publisher(s): Apress
- ISBN: 9781484204184
You might also like
book
Pro iPhone Development with Swift 5: Design and Manage Top Quality Apps
If you’ve already learned the basics of Swift and iOS programming, it’s time to take your …
book
Test-Driven Development in Swift: Compile Better Code with XCTest and TDD
Leverage Swift to practice effective and efficient test-driven development (TDD) methodology. Software testing and TDD are …
book
UI Design for iOS App Development: Using SwiftUI
Design is a challenge for most developers. Without a background or training in user interface skills, …
book
Swift Recipes for iOS Developers: Real-Life Code from App Store Apps
Boost your iOS developer career by learning from real-life examples and start writing code for one …