This file contains 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 Darwin | |
import Foundation | |
import UIKit | |
// https://github.com/xybp888/iOS-SDKs/blob/master/iPhoneOS17.1.sdk/System/Library/PrivateFrameworks/CoreSVG.framework/CoreSVG.tbd | |
// https://developer.limneos.net/index.php?ios=17.1&framework=UIKitCore.framework&header=UIImage.h | |
@objc | |
class CGSVGDocument: NSObject { } |
This file contains 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
public struct Tuple<each T> { | |
public private(set) var value: (repeat each T) | |
public init(_ value: repeat each T) { self.value = (repeat each value) } | |
} | |
extension Tuple { | |
public func map<each U>( | |
_ transform: (repeat each T) throws -> (repeat each U) | |
) rethrows -> (repeat each U) { |
This file contains 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
/// This is a list of Hypertext Transfer Protocol (HTTP) response status codes. | |
/// It includes codes from IETF internet standards, other IETF RFCs, other specifications, and some additional commonly used codes. | |
/// The first digit of the status code specifies one of five classes of response; an HTTP client must recognise these five classes at a minimum. | |
enum HTTPStatusCode: Int, Error { | |
/// The response class representation of status codes, these get grouped by their first digit. | |
enum ResponseType { | |
/// - informational: This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. | |
case informational |
This file contains 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
public let null = NSNull() as AnyHashable | |
public enum JSONObject { | |
case array([Any]) | |
case dictionary([String: Any]) | |
case fragment(Any) | |
} | |
extension JSONObject { | |
@inlinable public static func with(_ data: Data, options: JSONSerialization.ReadingOptions = []) throws -> JSONObject { |
This file contains 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
public func isEqual(_ x: Any, _ y: Any) -> Bool { | |
if let isEqual = (x as? any Equatable)?.isEqual(to: y) { | |
return isEqual | |
} else if let equatable = x as? AnyEquatable { | |
return equatable.isEqual(to: y) | |
} else { | |
return (x as? any OptionalProtocol).isNil && (y as? any OptionalProtocol).isNil | |
} | |
} |
This file contains 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
protocol CGContextRepresentable: View { | |
func draw(in context: CGContext, frame: CGRect) | |
} | |
extension CGContextRepresentable { | |
var body: some View { _CGContextView(draw: draw) } | |
} | |
private struct _CGContextView: UIViewRepresentable { | |
let draw: (CGContext, CGRect) -> Void |
This file contains 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
@propertyWrapper | |
public struct OnChangeObservable<Value: Equatable> { | |
private var storage: Storage | |
public var wrappedValue: Value { | |
get { storage.value } | |
set { storage.value = newValue } | |
} | |
public var projectedValue: OnChangeObservable<Value> { |
This file contains 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 Combine | |
public struct Event: Identifiable { | |
public let id: FSEventStreamEventId | |
public let path: String | |
public let flags: Flags | |
} | |
public class FileSystemEventStream { |
This file contains 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
extension UIView { | |
func publisher<G>(for gestureRecognizer: G) -> UIGestureRecognizer.Publisher<G> where G: UIGestureRecognizer { | |
UIGestureRecognizer.Publisher(gestureRecognizer: gestureRecognizer, view: self) | |
} | |
} | |
extension UIGestureRecognizer { | |
struct Publisher<G>: Combine.Publisher where G: UIGestureRecognizer { |
This file contains 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 | |
extension Dictionary where Key == String, Value == Any { | |
public subscript(keyPath: JSON.Path.Index...) -> Value? { | |
get { self[keyPath: .init(path: keyPath)] } | |
set { self[keyPath: .init(path: keyPath)] = newValue } | |
} | |
public subscript(keyPath keyPath: JSON.Path) -> Value? { |
NewerOlder