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 UIKit | |
| extension UIView { | |
| struct AnimationContext { | |
| public let duration: TimeInterval | |
| public let timingParameters: UITimingCurveProvider? | |
| } | |
| } | |
| extension UIView { |
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
| // | |
| // UIKit+DynamicStyle.swift | |
| // | |
| // Created by kaizei on 2019/7/19. | |
| // Copyright © 2019 yimi.kaizei. All rights reserved. | |
| // | |
| import UIKit | |
| // MARK: - reflect system style |
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
| struct ViewControllerHolder { | |
| weak var value: UIViewController? | |
| init(_ value: UIViewController?) { | |
| self.value = value | |
| } | |
| } | |
| struct ViewControllerKey: EnvironmentKey { | |
| static var defaultValue: ViewControllerHolder { return ViewControllerHolder(UIApplication.shared.windows.first?.rootViewController ) } |
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 UIKit | |
| class ViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // static images | |
| let lightImage = UIImage(named: "LightImage")! | |
| let darkImage = UIImage(named: "DarkImage")! |
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
| // | |
| // AppDelegate.swift | |
| // SwiftUITestApp | |
| // | |
| // Created by Matt Gallagher on 4/6/24. | |
| // Copyright © 2019 Matt Gallagher. All rights reserved. | |
| // | |
| import Cocoa | |
| 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
| /// Withable is a simple protocol to make constructing | |
| /// and modifying objects with multiple properties | |
| /// more pleasant (functional, chainable, point-free) | |
| public protocol Withable { | |
| init() | |
| } | |
| public extension Withable { | |
| /// Construct a new instance, setting an arbitrary subset of properties | |
| init(with config: (inout Self) -> Void) { |
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
| // Douglas Hill, December 2018 | |
| // Made for https://douglashill.co/reading-app/ | |
| // Find the latest version of this file at https://github.com/douglashill/KeyboardKit | |
| import UIKit | |
| /// A table view that allows navigation and selection using a hardware keyboard. | |
| /// Only supports a single section. | |
| class KeyboardTableView: UITableView { | |
| // These properties may be set or overridden to provide discoverability titles for key commands. |
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
| // | |
| // SKSerialInputStream.h | |
| // inputstream | |
| // | |
| // Created by Soroush Khanlou on 11/4/18. | |
| // Copyright © 2018 Soroush Khanlou. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |
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
| // # Why +0 is a better default than +1 for "normal function arguments". | |
| // | |
| // My intention here is to show why +0 is better default in a resilient | |
| // word. Keep in mind that inside individual modules and with inlinable | |
| // declarations, the optimizer can change conventions at will so from a defaults | |
| // perspective, these are not interesting. The interesting case is calling | |
| // non-inlinable functions in other modules. | |
| // | |
| // Consider a situation where I have a class Klass and a function foo that calls | |
| // a function bar in a different module. |
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
| on setDarkMode(shouldBeDark) | |
| set paneID to "com.apple.preference.general" | |
| tell application "System Events" | |
| if dark mode of appearance preferences is shouldBeDark then return | |
| end tell | |
| set paneWasOpen to false | |