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
/// A type-erased shape that is able to inset itself to produce another shape. | |
/// | |
/// See: [AnyShape](https://developer.apple.com/documentation/swiftui/anyshape), [InsettableShape](https://developer.apple.com/documentation/swiftui/insettableshape) | |
struct AnyInsettableShape: InsettableShape { | |
private let _sizeThatFits: (ProposedViewSize) -> CGSize | |
private let _path: (CGRect) -> Path | |
private let _inset: (CGFloat) -> AnyInsettableShape | |
init<S>(_ shape: S) where S : InsettableShape { |
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
/// iOS 15+ | |
func isPrewarm() -> Bool { | |
if let prewawrmEnv = ProcessInfo.processInfo.environment["ActivePrewarm"], | |
prewawrmEnv == "1" { | |
return true | |
} else { | |
return false | |
} | |
} |
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
@ViewBuilder | |
private func build<#name#>(_ viewStore: ViewStoreType) -> some View { | |
} |
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
// | |
// FacebookAuth.swift | |
// GitHub: ethanhuang13 | |
// Twitter: @ethanhuang13 | |
import AuthenticationServices | |
import SafariServices | |
/* | |
Updated: |
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
// | |
// Usage: | |
// | |
// Facebook: | |
// | |
// 1. Follow this guide (WITHOUT setting up a URL scheme in Xcode): | |
// https://github.com/fullstackreact/react-native-oauth/issues/76#issuecomment-335902057 | |
// | |
// 2. call startFacebookAuthenticationSession(appID:completionHandler:) on a window: | |
// |
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
enum Equality<T: Equatable> { | |
case equal(T) | |
case notEqual | |
} | |
func == <T: Equatable>(lhs: T, rhs: T) -> Equality<T> { | |
if lhs == rhs { | |
return .equal(lhs) | |
} else { | |
return .notEqual |
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 Combine | |
import UIKit | |
public protocol CombineCompatible {} | |
// MARK: - UIControl | |
public extension UIControl { | |
final class Subscription<SubscriberType: Subscriber, Control: UIControl>: Combine.Subscription where SubscriberType.Input == Control { | |
private var subscriber: SubscriberType? | |
private let input: Control |
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 | |
enum PromiseError: Error { | |
case invaild | |
} | |
public struct AsyncExecutor { | |
public static let main = AsyncExecutor() | |
public static let background = AsyncExecutor(qos: .default) | |
private let queue: DispatchQueue |
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
// | |
// MapHelper.swift | |
// | |
// Created by Michael Vieth on 1/6/20. | |
// | |
import Foundation | |
import GoogleMaps | |
import GoogleMapsBase | |
import MapKit |
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
// Created by Marcin Krzyzanowski | |
import Foundation | |
public protocol JSONEncodable: Encodable { } | |
public extension JSONEncodable { | |
func toJSON(using encoder: @autoclosure () -> JSONEncoder = JSONEncoder()) throws -> String { | |
try String(decoding: encoder().encode(self), as: UTF8.self) | |
} |
NewerOlder