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 | |
import SwiftUI | |
#if canImport(UIKit) | |
import UIKit | |
#elseif canImport(AppKit) | |
import AppKit | |
#endif | |
extension Image { | |
/// Initializes a SwiftUI `Image` from data. |
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 | |
import CryptoKit | |
extension String { | |
func hmacUsingSHA1(_ secretString: String) -> String { | |
let key = SymmetricKey(data: secretString.data(using: .utf8)!) | |
let signature = HMAC<Insecure.SHA1>.authenticationCode(for: self.data(using: .utf8)!, using: key) | |
return Data(signature).map { String(format: "%02hhx", $0) }.joined() |
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 | |
import PlaygroundSupport | |
typealias DispatcherIdentifier = String | |
class Dispatcher { | |
private var items = [DispatcherIdentifier: DispatchWorkItem]() | |
private let queue: DispatchQueue | |
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
let label = UILabel() | |
label.text = "Swift is a modern, intuitive programming language crafted for all Apple platforms." | |
label.setValue(true, forKey: "marqueeEnabled") | |
label.setValue(true, forKey: "marqueeRunning") | |
label.setValue(0, forKey: "marqueeRepeatCount") |
OlderNewer