This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i386 : iPhone Simulator | |
x86_64 : iPhone Simulator | |
arm64 : iPhone Simulator | |
iPhone1,1 : iPhone | |
iPhone1,2 : iPhone 3G | |
iPhone2,1 : iPhone 3GS | |
iPhone3,1 : iPhone 4 | |
iPhone3,2 : iPhone 4 GSM Rev A | |
iPhone3,3 : iPhone 4 CDMA | |
iPhone4,1 : iPhone 4S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UserDefaultsStorage { | |
/// Previously stored migration data. | |
/// | |
/// - From the cache, if available. The cache has the same lifetime as the session. | |
/// - If the cache is not available, try from UserDefaults, save to the cache. | |
/// - If UserDefaults doesn't have any data, then return `defaultStoreData` and save to UserDefaults. | |
/// | |
/// - Returns: a struct describing model version, settings bundle and onboarding bundle. | |
private var storedMigrationData: MigrationData { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the model version is stored if migrations are needed in the future | |
#warning("Can we inline this into UserDefaultsStorage or get rid of it entirely?") | |
private struct MigrationData: Codable { | |
var modelVersion: String | |
var settingsBundle: SettingsBundle | |
var onboardingBundle: OnboardingBundle | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class UserDefaultsStorage: Storage { | |
let modelVersion: String | |
let key: String | |
init(withKey: String, modelVersion: String) { | |
key = withKey | |
self.modelVersion = modelVersion | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SimpleMath | |
// Copyright (c) Filip Lazov 2020 | |
// MIT license - see LICENSE file for more info | |
import Foundation | |
final class UserDefaultsStorage: Storage { | |
let modelVersion: String | |
let key: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#warning("Documentation needs work.") | |
#warning("Who is calling `storedData`? Why is it private?") | |
/// What data? | |
/// - The cache, if available. | |
/// - If the cache is not available, try from UserDefaults | |
/// - If UserDefaults doesn't have any data, then return `defaultStoreData` | |
/// | |
/// - Returns: a Store Data object? | |
private var storedData: StoredData { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Country { | |
var code: String? | |
var name: String? | |
var phoneCode: String? | |
var flag: UIImage? { | |
guard let code = self.code else { return nil } | |
return UIImage(named: "SwiftCountryPicker.bundle/Images/\(code.uppercased())", in: Bundle(for: MRCountryPicker.self), compatibleWith: nil) | |
} | |
init(code: String?, name: String?, phoneCode: String?) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func setup() { | |
// Loading a JSON with our country list. | |
// If our data is invalid, make sure to catch it early in the development process. | |
let frameworkBundle = Bundle(for: type(of: self)) | |
let defaultCountriesJSONPath = frameworkBundle.path(forResource: "SwiftCountryPicker.bundle/Data/countryCodes", | |
ofType: "json")! | |
let defaultCountriesJSONData = try! Data(contentsOf: URL(fileURLWithPath: defaultCountriesJSONPath)) | |
let defaultCountriesDictionaries = try! JSONSerialization.jsonObject(with: defaultCountriesJSONData, | |
options: .allowFragments) as! NSArray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import CoreLocation | |
class Location: NSObject { | |
static let shared = Location() | |
private override init() { | |
super.init() | |
manager.delegate = self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef NS_ENUM(NSUInteger, Degrees) { | |
DegreesCelsius, | |
DegreesFahrenheit, | |
DegreesKelvin, | |
}; | |
- (NSString *)highestTemperatureForecasted:(WAForecastModel *)forecast degrees:(Degrees)type; | |
{ | |
WADayForecast *dailyForecast = forecast.dailyForecasts.firstObject; | |
NewerOlder