An Xcode/CoreSimulator command line utility to control iOS Simulators on MacOS
simctl [--set <path>] [--profiles <path>] <subcommand> ...
simctl help [subcommand]
| import UIKit | |
| //Abbreviated OpenAPI product response for example purposes | |
| let jsonData = """ | |
| { | |
| "paging": { | |
| "total": 8, | |
| "offset": 0, | |
| "limit": 40, | |
| "returned": 8 |
| //Simple Type - Person | |
| struct Person: Codable { | |
| let name: String | |
| let age: Int | |
| func getString() -> String { | |
| return "Name: \(name), Age: \(age)" | |
| } | |
| } |
| struct Device { | |
| /// Detects if the current architecture is a Simulator | |
| static let isSimulator: Bool = { | |
| var isSim = false | |
| #if arch(i386) || arch(x86_64) | |
| isSim = true | |
| #endif | |
| return isSim | |
| }() |
| extension String { | |
| func getDecimalDigits(includeDecimal: Bool = true) -> String { | |
| let set = includeDecimal ? "1234567890.": "1234567890" | |
| return self.components(separatedBy: CharacterSet(charactersIn: set).inverted).joined() | |
| } | |
| func lettersOnly() -> String { | |
| let characterSet = CharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ").inverted |