
Swift Essentials (Second Edition)
Beschreibung
Alle Preise
Weitere Details
Weitere Ausgaben
Person
contacted on 30 aug 16 _____________ Dr Alex Blewitt has over 20 years of experience in Objective-C and has been using Apple frameworks since NeXTstep 3.0. He upgraded his NeXTstation for a TiBook when Apple released Mac OS X in 2001 and has been developing on it ever since. Alex currently works for an investment bank in London, writes for the on-line technology news site InfoQ and has published two other books for Packt publishing. He also has a number of apps on the Apple AppStore through Bandlem Limited. When he's not working on technology, and if the weather is nice, he likes to go flying from the nearby Cranfield airport. Alex writes regularly at his blog, http://alblue.bandlem.com, as well tweeting regularly from Twitter as @alblue. Acknowledgements This book would not have been possible without the ongoing love and support of my wife Amy, who has helped me through both the highs and lows of life. She gave me the freedom to work during the many late nights and weekends that it takes to produce a book and its associated code repository. She truly is the Lem of my life. I'd also like to thank my parents, Ann and Derek, for their encouragement and support during my formative years. It was this work ethic that allowed me to start my technology career as a teenager and to incorporate my first company before I was 25. I'd also like to congratulate them on their 50th wedding anniversary in 2015, and I look forward to reaching that goal with Amy. Thanks are due especially to the reviewer of this version of the book: Antonio Bello, as well as the previous version of this book: Nate Cook, James Robert and Arvid Gerstmann, who provided excellent feedback on the contents of this book during development and caught many errors in both the text and code. Any remaining errors are my own. I'd also like to thank my children Sam and Holly for inspiring me and hope that they too can achieve anything that they set their minds to. Finally, I'd like to thank Ben Moseley and Eren Kotan, both of whom introduced me to NeXT in the first place and set my career going on a twenty year journey to this book.
Inhalt
- Cover
- Copyright
- Credits
- About the Author
- Acknowledgments
- About the Reviewer
- www.PacktPub.com
- Table of Contents
- Preface
- Chapter 1: Exploring Swift
- Open source Swift
- Getting started with Swift
- Numeric literals
- Floating point literals
- String literals
- Variables and constants
- Collection types
- Optional types
- Nil coalescing operator
- Conditional logic
- If statements
- Switch statements
- Iteration
- Iterating over keys and values in a dictionary
- Iteration with for loops
- Break and continue
- Functions
- Named arguments
- Optional arguments and default values
- Guards
- Multiple return values and arguments
- Returning structured values
- Error handling
- Throwing errors
- Catching errors
- Cleaning up after errors
- Command-line Swift
- Interpreted Swift scripts
- Compiled Swift scripts
- Summary
- Chapter 2: Playing with Swift
- Getting started with playgrounds
- Creating a playground
- Viewing the console output
- Viewing the timeline
- Displaying objects with Quick Look
- Showing colored labels
- Showing images
- Advanced techniques
- Capturing values explicitly
- Running asynchronous code
- Playgrounds and documentation
- Learning with playgrounds
- Understanding the playground format
- Adding a page
- Documenting code
- Playground navigation documentation
- Text formatting
- Symbol documentation
- Limitations of playgrounds
- Summary
- Chapter 3: Creating an iOS Swift App
- Understanding iOS applications
- Creating a single-view iOS application
- Removing the storyboard
- Setting up the view controller
- Swift classes, protocols, and enums
- Classes in Swift
- Subclasses and testing in Swift
- Protocols in Swift
- Enums in Swift
- Raw values
- Associated values
- Creating a master-detail iOS application
- The AppDelegate class
- The MasterViewController class
- The DetailViewController class
- Summary
- Chapter 4: Storyboard Applications with Swift and iOS
- Storyboards, scenes, and segues
- Creating a storyboard project
- Scenes and view controllers
- Adding views to the scene
- Segues
- Adding a navigation controller
- Naming scenes and views
- Swift and storyboards
- Custom view controllers
- Connecting views to outlets in Swift
- Calling actions from interface builder
- Triggering a segue with code
- Passing data with segues
- Using Auto Layout
- Understanding constraints
- Adding constraints
- Adding a constraint with drag and drop
- Adding constraints to the Press Me scene
- Adding missing constraints
- Summary
- Chapter 5: Creating Custom Views in Swift
- An overview of UIView
- Creating new views with Interface Builder
- Creating a table view controller
- Showing data in the table
- Defining a view in a xib file
- Wiring a custom view class
- Dealing with intrinsic size
- Creating new views by subclassing UIView
- Auto Layout and custom views
- Constraints and the visual format language
- Adding the custom view to the table
- Custom graphics with drawRect
- Drawing graphics in drawRect
- Responding to orientation changes
- Custom graphics with layers
- Creating a ProgressView from layers
- Adding the stop square
- Adding a progress bar
- Clipping the view
- Testing views in Xcode
- Responding to change
- Summary
- Chapter 6: Parsing Networked Data
- Loading data from URLs
- Dealing with errors
- Dealing with missing content
- Nested if and switch statements
- Networking and user interfaces
- Running functions on the main thread
- Parsing JSON
- Handling errors
- Parsing XML
- Creating a parser delegate
- Downloading the data
- Parsing the data
- Direct network connections
- Opening a stream-based connection
- Synchronous reading and writing
- Writing data to NSOutputStream
- Reading from an NSInputStream
- Reading and writing hexadecimal and UTF8 data
- Implementing the Git protocol
- Listing git references remotely
- Integrating the network call into the UI
- Asynchronous reading and writing
- Reading data asynchronously from an NSInputStream
- Creating a stream delegate
- Dealing with errors
- Listing references asynchronously
- Displaying asynchronous references in the UI
- Writing data asynchronously to an NSOutputStream
- Summary
- Chapter 7: Building a Repository Browser
- An overview of the GitHub API
- Root endpoint
- User resource
- Repositories resource
- Repository browser project
- URI templates
- Background threading
- Parsing JSON dictionaries
- Parsing JSON arrays of dictionaries
- Creating the client
- Talking to the GitHub API
- Returning repositories for a user
- Accessing data through the AppDelegate
- Accessing repositories from view controllers
- Adding users
- Implementing the detail view
- Transitioning between the master and detail views
- Loading the user's avatar
- Displaying the user's avatar
- Summary
- Chapter 8: Adding Watch Support
- Watch applications
- Adding a watch target
- Adding the GitHubAPI to the watch target
- Creating watch interfaces
- Adding a list of users to the watch
- Wiring up the interface
- Adding an image
- Responding to user interaction
- Adding context and showing repositories
- Adding a detail screen
- Populating the detail screen
- Best practice for watch applications
- UI thread considerations
- Stored data
- Appropriate use of complications and glances
- Summary
- Appendix: References to Swift-related Websites, Blogs, and Notable Twitter Users
- Language
- Twitter users
- Blogs and tutorial sites
- Meetups
- Afterword
- Index
Systemvoraussetzungen
Dateiformat: ePUB
Kopierschutz: Adobe-DRM (Digital Rights Management)
Systemvoraussetzungen:
- Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).
- Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions oder die App PocketBook (siehe E-Book Hilfe).
- E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)
Das Dateiformat ePUB ist sehr gut für Romane und Sachbücher geeignet – also für „fließenden” Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an.
Mit Adobe-DRM wird hier ein „harter” Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.
Bitte beachten Sie: Wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!
Weitere Informationen finden Sie in unserer E-Book Hilfe.
Dateiformat: PDF
Kopierschutz: Adobe-DRM (Digital Rights Management)
Systemvoraussetzungen:
- Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).
- Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions oder die App PocketBook (siehe E-Book Hilfe).
- E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)
Das Dateiformat PDF zeigt auf jeder Hardware eine Buchseite stets identisch an. Daher ist eine PDF auch für ein komplexes Layout geeignet, wie es bei Lehr- und Fachbüchern verwendet wird (Bilder, Tabellen, Spalten, Fußnoten). Bei kleinen Displays von E-Readern oder Smartphones sind PDF leider eher nervig, weil zu viel Scrollen notwendig ist.
Mit Adobe-DRM wird hier ein „harter” Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.
Bitte beachten Sie: Wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!
Weitere Informationen finden Sie in unserer E-Book Hilfe.