Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Jonathon Manning, Paris Buttfield-Addison, Tim Nugent

Rating No ratings yet

Get valuable hands-on experience with Swift, the open source programming language developed by Apple. With this practical guide, skilled programmers with little or no knowledge of Apple development will learn how to code with the latest version of Swift by developing a working iOS app from start to finish. You’ll begin with Swift programming basics—including guidelines for making your code "Swifty"—and learn how to work with Xcode and its built-in Interface Builder. Then you’ll dive step-by-step into building and customizing a basic app for taking, editing, and deleting selfies. You’ll also tune and test the app for performance and manage the app’s presence in the App Store. Divided into four parts, this book includes: Swift 4 basics: Learn Swift’s basic building blocks and the features of object-oriented development Building the Selfiegram app: Build model objects and the UI for your selfie app and add location support, user settings, and notifications Polishing Selfiegram: Create a theme and support for sharing and add custom views, image overlays, and localization Beyond app development: Debug and performance test with Xcode, automate chores with Fastlane, and user-test the app with TestFlight

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on, project-driven introduction to Swift 4 and Apple development, this book teaches you the language fundamentals and object-oriented features while guiding you through building a complete, polished iOS app (Selfiegram) from scratch—ideal for experienced programmers new to Apple's ecosystem. 【Book Arc】 - **Opening (~0%–9%)**: Introduces the book's structure and goals, then walks you through installing and setting up Xcode, including a tour of its interface, the Interface Builder, and essential navigators—establishing the toolchain you'll use throughout. - **Early (~9%–28%)**: Covers Swift language fundamentals: variables, constants (`let` vs `var`), type inference, operators, control flow (loops, switches), and core collection types like arrays, dictionaries, and sets—with emphasis on Swift's safety features like optionals and type checking. - **Early (~28%–38%)**: Delves into object-oriented development: functions and closures, `inout` parameters, classes and structs, computed properties, property observers, lazy properties, and extensions—building the mental model for Swift's approach to OOP. - **Middle (~38%–47%)**: Explores advanced language features: protocols and default implementations, error handling with `try`/`catch`/`try?`/`try!`, and memory management via reference counting and ownership—plus an introduction to Cocoa's delegation pattern for app architecture. - **Middle (~47%–end)**: Transitions from language to app development: building the Selfiegram app's model objects and UI, adding location support, user settings, and notifications, then polishing with themes, sharing, custom views, and localization—finishing with debugging, performance testing, Fastlane automation, and TestFlight user testing. 【Key Takeaways】 - **Swift prioritizes safety through type inference and constants** (Early): The compiler infers types from context, and `let` declares immutable values that prevent accidental changes—reducing bugs and making code more predictable. - **Optionals are a core Swift concept for handling absence** (Early): Variables can be optional (able to hold `nil`) or non-optional; unwrapping with `!` is powerful but crashes on `nil`, so prefer safe unwrapping or implicitly unwrapped optionals when appropriate. - **Sets offer unique, unordered collections with high-performance operations** (Early): Unlike arrays, sets excel at unions, intersections, and membership checks—choose them when order doesn't matter and uniqueness is guaranteed. - **Property observers and lazy properties add dynamic behavior** (Early): `willSet` and `didSet` hooks let you react to property changes, while lazy properties defer expensive setup until first access—improving both flexibility and performance. - **Extensions and protocols enable flexible, non-invasive code design** (Middle): Extensions add computed properties and protocol conformance to existing types, and default protocol implementations reduce boilerplate—promoting loose coupling. - **Error handling in Swift is explicit and multi-layered** (Middle): Use `do-catch` for recoverable errors, `try?` to convert failures to optionals, and `try!` only when you're certain a call won't fail—each approach trades safety for convenience. - **Memory management is automatic via reference counting** (Middle): The compiler tracks object ownership, so you rarely manage memory manually—think in terms of ownership rather than numeric retain counts to avoid confusion. - **Delegation is a key Cocoa pattern for app architecture** (Middle): Objects can check at runtime whether a delegate implements a method, enabling loose coupling and letting one object serve as delegate for multiple sources—central to building iOS apps. 【Reading Tips】 - **Skim the Xcode interface tour** (Opening): If you've used any IDE, you can quickly scan this section and return later when you need specific navigator or Interface Builder details. - **Deep-read the Swift language chapters** (Early): These are foundational—pay close attention to optionals, type inference, and collection types, as they'll appear constantly in the app-building sections. - **Practice the OOP concepts with small examples** (Early–Middle): Computed properties, observers, and extensions are best understood by writing and modifying code, not just reading—try extending a simple class yourself. - **Focus on the delegation pattern** (Middle): It's the bridge between language features and real app architecture; understanding it will make the Selfiegram UI code much clearer. - **Use the Selfiegram project as your guide** (Middle–End): Don't just read—build along. The app serves as a practical case study that ties together all the language concepts into a working product. 【Coverage Limits】 This guide synthesizes the book's first half (language fundamentals and OOP concepts) and outlines the app-building arc, but the excerpts do not cover the detailed implementation of Selfiegram's UI, location services, or the final debugging and deployment chapters.
Excerpt 1
97 Swift Package Manager 101 Conclusion 107 Part II. Building Selfiegram 4. Setting Up Our App. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
View in text
Excerpt 2
that the type of the number variable isn’t defined—the com‐ piler infers that, given that numbers is an array of Int values, number should itself be an Int....
View in text
Excerpt 3
onalInteger = 1 1 + implicitlyUnwrappedOptionalInteger // 2 Implicitly unwrapped optionals are regular optionals: they can either contain nil, or not. Howeve...
View in text
Excerpt 4
t, you own it. When you are done you relinquish this owner‐ ship, and when no objects own another object, it goes away. You are only responsible for those ob...
View in text
Excerpt 5
gure 4-6. The Master-Detail template UI The Structure | 119 This property returns a UIImage from the disk that is the actual image compo‐ nent of the selfie—...
View in text
Excerpt 6
-action mechanism is used in many different Cocoa and Cocoa Touch frameworks as a way for objects to talk to one another. The basic idea is that the target (...
View in text
Excerpt 7
ghtforward. The method returns an array of locations, which may contain one or several items. We want the last location in the array, because the locations a...
View in text
Excerpt 8
ogether something ourselves using UIImageViews to create an approximation of what the camera sees, but it would be a bad hack and look terrible. It’s much ea...
View in text
Tags
AI categories
Programming LanguageiosMobile
ISBN: 149198757X
Publisher: O’Reilly Media
Publish Year: 2018
Language: English
Pages: 378
File Format: PDF
File Size: 16.2 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…