Tutorial and tips for GitHub Actions workflows
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 SwiftUI | |
| struct MyValue: _ViewTraitKey { | |
| static var defaultValue: Int = 0 | |
| } | |
| extension View { | |
| func myValue(_ value: Int) -> some View { | |
| _trait(MyValue.self, value) | |
| } |
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 SwiftUI | |
| import WebKit | |
| struct WebView: UIViewRepresentable { | |
| class Coordinator: NSObject, WKNavigationDelegate, WKScriptMessageHandler { | |
| var webView: WKWebView? | |
| func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | |
| self.webView = webView | |
| } |
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 SwiftUI | |
| private let linkDetector = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) | |
| struct LinkColoredText: View { | |
| enum Component { | |
| case text(String) | |
| case link(String, URL) | |
| } | |
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 | |
| public extension UIApplication { | |
| func override(_ userInterfaceStyle: UIUserInterfaceStyle) { | |
| if supportsMultipleScenes { | |
| for connectedScene in connectedScenes { | |
| if let scene = connectedScene as? UIWindowScene { | |
| for window in scene.windows { | |
| window.overrideUserInterfaceStyle = userInterfaceStyle |
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 | |
| public struct InfiniteIterator<Base: Collection>: IteratorProtocol { | |
| private let collection: Base | |
| private var index: Base.Index | |
| public init(collection: Base) { | |
| self.collection = collection | |
| self.index = collection.startIndex |
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
| // Written using Swift 3.0.x | |
| fileprivate final class Box<T> { | |
| let unbox: T | |
| init(_ value: T) { | |
| unbox = value | |
| } | |
| } | |
| public struct CopyOnWrite<T: AnyObject> { |
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
| // | |
| // KeyStorage - Simplifying securely saving key information | |
| // | |
| // KeyChainAccessGroupHelper.swift | |
| // Created by Ben Bahrenburg on 12/30/16. | |
| // Copyright © 2017 bencoding.com. All rights reserved. | |
| // | |
| import Foundation | |
| import Security |
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
| // | |
| // KeychainManager.swift | |
| // KeychainAccess | |
| // | |
| // Created by Cameron Smith on 5/6/16. | |
| // Copyright © 2016 Flying Moose Development. All rights reserved. | |
| // | |
| import Foundation |
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
| // | |
| // HMAC.swift | |
| // | |
| // Created by Mihael Isaev on 21.04.15. | |
| // Copyright (c) 2014 Mihael Isaev inc. All rights reserved. | |
| // | |
| // *********************************************************** | |
| // | |
| // How to import CommonCrypto in Swift project without Obj-c briging header | |
| // |
NewerOlder