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 CoreText | |
struct FontUtils { | |
enum Error: Swift.Error { | |
case dataProviderConstructionFailed | |
case cgFontConstructionFailed | |
case postScriptNameUnavailable |
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 file is subject to the terms and conditions defined in | |
// file 'LICENSE.txt', which is part of this source code package. | |
// | |
import SwiftUI | |
import UIKit | |
struct UIKitTextField : UIViewRepresentable { | |
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 | |
struct Anonymous<Output, Failure> : Publisher where Failure : Error { | |
var onSubscribe: (Observer) -> Cancellable | |
func receive<S>(subscriber: S) where Output == S.Input, Failure == S.Failure, S : Combine.Subscriber { | |
subscriber.receive(subscription: Sink(parent: self, downstream: subscriber)) | |
} |
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
// | |
// (See usage below implementation) | |
// | |
// SwiftUI `CollectionView` type implemented with UIKit's UICollectionView under the hood. | |
// Requires `UIViewControllerRepresentable` over `UIViewRepresentable` as the type that allows | |
// for SwiftUI `View`s to be added as subviews of UIKit `UIView`s at all bridges this gap as | |
// the `UIHostingController`. | |
// | |
// Not battle-tested yet, but seems to be working well so far. | |
// Expect changes. |