April 2015
Intermediate to advanced
556 pages
17h 47m
English
You will be registering factory defaults, writing user preferences for defaults, and reading values for defaults, all based on a string that names each default. You will define a constant string for each of the default names.
At the top of PreferenceManager.swift, above the PreferenceManager, add the following constants:
import Foundation
private let activeVoiceKey = "activeVoice"
private let activeTextKey = "activeText"
class PreferenceManager {
Why define constants that simply contain a fixed string? After all, you could just remember what the string was and type it in whenever you need it. The danger is that you might misspell the string. If the string is surrounded by quotes, the compiler will ...
Read now
Unlock full access