Filters

Hide filters
Platform
Content Type
Difficulty

All Tutorials · 40 Results

Contained in: UIKit Apprentice swift
iOS & Swift

Chapter in UIKit Apprentice

Swift Review

…have made great progress! You've learnt the basics of Swift programming and created two applications from scratch. Now let's add some more Swift theory to strengthen the foundations we've built while creting those two apps…
iOS & Swift

Chapter in UIKit Apprentice

Introduction

Welcome to The UIKit Apprentice! In this book, you're about to deep dive into the latest and greatest Swift and iOS best practices. You will build four iOS projects using Swift and UIKit. Good luck…
iOS & Swift

Chapter in UIKit Apprentice

The One-Button App

Newer versions of Xcode may also work, but anything older than version 16.0 might not work correctly with the code in this book. Because Swift is a new-ish language, it tends to change between versions of Xcode. If your Xcode is too old — or too new! — then…
iOS & Swift

Chapter in UIKit Apprentice

Objects vs. Classes

Time for some more theory! You'll learn all about objects, classes, inheritance, and a few other object oriented principles from Swift that you need to be familiar with…
iOS & Swift

Chapter in UIKit Apprentice

Add Item Screen

…message, as "1" is a string, not an Int. To a human reader they look similar and you can easily understand the intent, but Swift isn’t that tolerant. Data types have to match or they just aren’t allowed. Your most recent version of this method looks like this…
iOS & Swift

Chapter in UIKit Apprentice

Saving & Loading

…data storage, and best of all, they are simple to use. What’s not to like? To save the checklist items, you’ll use Swift’s Codable protocol, which lets objects which support the Codable protocol to store themselves in a structured file format. You actually don’t have…
iOS & Swift

Chapter in UIKit Apprentice

Table Views

…quickest way to learn! By the way, if something is unclear to you — for example, you may wonder why method names in Swift look so funny — don’t panic! Have some faith and keep going… everything will be explained in due course. The Checklists app design Just so you know…
iOS & Swift

Chapter in UIKit Apprentice

Saving Locations

…objects if you use Relationships and Fetched Properties. In a short while, you’re going to define your own Location class by creating a Swift file, just as you’ve been doing all along. Because it describes a managed object, this class will be associated with the Location entity…
iOS & Swift

Chapter in UIKit Apprentice

Delegates & Protocols

ChecklistViewController without it having to know anything about the latter. Delegates go hand-in-hand with protocols, a prominent feature of the Swift language. The delegate protocol ➤ At the top of AddItemViewController.swift, add the following after the import line, but before the class line — it is not part…
iOS & Swift

Chapter in UIKit Apprentice

Outlets

…scope. The scope of a variable depends on where in your program you defined that variable. There are three possible scope levels in Swift: Global scope: These objects exist for the duration of the app and are accessible from anywhere. Instance scope: This is for variables such as currentValue. These…
iOS & Swift

Chapter in UIKit Apprentice

Polishing the App

Recall that String is a struct, which is a value type, and therefore cannot be modified when declared with let. The mutating keyword tells Swift that the add(text:separatedBy:) method can only be used on strings that are made with var, but not on strings made with…
iOS & Swift

Chapter in UIKit Apprentice

Slider & Labels

…landscape orientation right from the start. Understanding objects, data and methods Time for some programming theory. No, you can’t escape it. :] Swift is a so-called “object-oriented” programming language, which means that most of the stuff you do involves objects of some kind. I already mentioned…
iOS & Swift

Chapter in UIKit Apprentice

Lists

…next step, choose the following options: Class: AllListsViewController Subclass of: UITableViewController Also create XIB file: Make sure this is not checked Language: Swift Note: Make sure the “Subclass of” field is set to UITableViewController, not “UIViewController”. Also be careful that Xcode didn’t rename what you typed into Class…
iOS & Swift

Chapter in UIKit Apprentice

The Data Model

…checked” instance variable. Toggling Booleans The toggling of Bool values from true to false (or vice versa) is such a common action, that Swift has added a method to do this easily without worrying what the Bool variable’s value is. This method is called toggle and you simply call…
iOS & Swift

Chapter in UIKit Apprentice

Networking

Currently, all of this sits in a String, which isn’t very handy, but using a JSON parser you can turn this data into Swift Dictionary and Array objects. JSON or XML? JSON is not the only structured data format out there. XML, which stands for EXtensible Markup Language…
iOS & Swift

Chapter in UIKit Apprentice

Refactoring

…returns no value. Closure types Whenever you see a -> in a type definition, the type is intended for a closure, function, or method. Swift treats these three things as mostly interchangeable. Closures, functions, and methods are all blocks of source code that possibly take parameters and return a value…
iOS & Swift

Chapter in UIKit Apprentice

URLSession

HTTP response headers. Excellent! A brief review of closures You’ve seen closures a few times now. They are a really powerful feature of Swift and you can expect to be using them all the time when you’re working with Swift code. So, it’s good to have…
iOS & Swift
UIKit Apprentice
Complete Beginners! If you’re completely new to Swift and iOS development (or need a brush-up), this is the series for you. The UIKit Apprentice is a series of epic-length tutorials for beginners where you’ll learn how to build four complete apps from scratch. Each…
iOS & Swift

Chapter in UIKit Apprentice

The Locations Tab

…powerful feature of Objective-C, but unfortunately, a dynamic type like id doesn’t really fit in a strongly typed language such as Swift. Still, we can’t avoid id completely because it’s so prevalent in iOS frameworks. The Swift equivalent of id is the Any type. The sender…
iOS & Swift

Chapter in UIKit Apprentice

Use Location Data

…error, lastLocationError will not have a value. In other words, it can be nil, and variables that can be nil must be optionals in Swift. Finally, the update to locationManager(_:didFailWithError:) adds a new method call: stopLocationManager() Stop location updates If obtaining a location appears to be impossible for wherever…