This file contains hidden or 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
| @Model | |
| final public class Drink { | |
| /// Holds the JSON-encoded data blob representing the Measurement. | |
| private var _measurement: Data? | |
| /// The actual Measurement, encoded/decoded on-the-fly. | |
| @Transient var measurement: Measurement<UnitVolume> { | |
| get { getMeasurement() } | |
| set { setMeasurement(newValue) } | |
| } |
This file contains hidden or 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 | |
| enum Marker: String { | |
| case x = "x" | |
| case o = "o" | |
| } | |
| typealias Position = Int | |
| enum ValidPositions { |
This file contains hidden or 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
| // Inspired by this Hacker News comment: | |
| // https://news.ycombinator.com/item?id=34954579 | |
| // | |
| // OEM Windows 95 keys came in the form of XXXXX-OEM-00YYYYY-ZZZZZ. The XXXXX grouping represents when Microsoft issued the key by day-of-year and year, and the operating system would validate any number where the first three numbers range from 001 to 365 (or 366 for year 96), and the last two X digits were 95-99. The YYYYY group must be a multiple to 7, excluding the number 0. The ZZZZZ group is basically noise and anything is permissible in them. | |
| // | |
| // Now you can run a Windows 95 keygen in your head. You're welcome :) | |
| // | |
| import Foundation | |
| import Swift |
This file contains hidden or 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
| // | |
| // ContentView.swift | |
| // Listomania | |
| // | |
| // Created by Jack Newcombe on 05/06/2019. | |
| // Copyright © 2019 Jack Newcombe. All rights reserved. | |
| // | |
| import SwiftUI |
This file contains hidden or 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
| // Change the app icon without showing the system alert | |
| // The trick is to call setAlternateIconName(_:completionHandler:), then | |
| // immediately show (then immediately hide) a temp ViewController. | |
| // This seems to interrupt the system dialog box, which never shows. | |
| if UIApplication.shared.supportsAlternateIcons { | |
| UIApplication.shared.setAlternateIconName("nameOfAlternateIcon") | |
| let tempViewController = UIViewController() | |