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 UIKit | |
import SwiftUI | |
extension Font { | |
public init(uiFont: UIFont) { | |
self.init(uiFont as CTFont) | |
} | |
public func toUIFont() -> UIFont? { | |
var font: UIFont? |
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
// | |
// Keyboard.swift | |
// | |
// Created by Bojan Percevic on 5/21/15. | |
// Copyright (c) 2015 Bojan Percevic. All rights reserved. | |
// | |
import AppKit | |
enum Key: CUnsignedShort { |
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 | |
public protocol AssociatingObject: AnyObject { | |
@inlinable | |
@discardableResult | |
func setAssociatedObject<Object>( | |
_ object: Object, | |
forKey key: StaticString, | |
policy: objc_AssociationPolicy | |
) -> Bool |
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 <AVFoundation/AVFoundation.h> | |
@interface MLWAsyncAVPlayer : AVPlayer | |
@end |
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
// Modification of source: https://github.com/pointfreeco/swift-case-paths/blob/master/Sources/CasePaths/CasePath.swift | |
/// A path that supports embedding a value in a root and attempting to extract a root's embedded | |
/// value. | |
/// | |
/// This type defines key path-like semantics for enum cases. | |
public struct FunctionalKeyPath<Root, Value> { | |
private let _embed: (Value, Root) -> Root | |
private let _extract: (Root) -> 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
@dynamicMemberLookup | |
@propertyWrapper | |
public <#class or struct#> <#Prefix#>Box<Content> { | |
public var content: Content | |
@inlinable | |
public var wrappedValue: Content { | |
get { content } | |
set { content = newValue } | |
} |
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 <#Box#>: ExpressibleByNilLiteral where Content: ExpressibleByNilLiteral { | |
@inlinable | |
public convenience init(nilLiteral: Void) { self.init(nilLiteral: nilLiteral) } | |
} | |
extension <#Box#>: ExpressibleByFloatLiteral where Content: ExpressibleByFloatLiteral { | |
@inlinable | |
public convenience init(floatLiteral value: Content.FloatLiteralType) { | |
self.init(.init(floatLiteral: 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
@dynamicMemberLookup | |
@propertyWrapper | |
public struct IdentifiableBox<Content: Hashable>: Identifiable { | |
public var id: Int { content.hashValue } | |
public var content: Content | |
@inlinable | |
public var wrappedValue: Content { | |
get { content } | |
set { content = newValue } |
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
// Depends on `Builder`: https://gist.github.com/maximkrouk/eede7171952e044492c1fa57291bcf94 | |
// Depends on Model.swift | |
import Vapor | |
import Fluent | |
enum GenericController<Model: APIModel> | |
where Model.IDValue: LosslessStringConvertible { | |
/// ID parameter key |
NewerOlder