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
| private protocol AnyViewConvertible { | |
| func anyView() -> AnyView | |
| } | |
| extension View { | |
| func anyView() -> AnyView { | |
| return AnyView(self) | |
| } | |
| } |
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 | |
| public struct OrderedSet<E: Hashable>: Equatable, Collection { | |
| public typealias Element = E | |
| public typealias Index = Int | |
| public typealias Indices = Range<Int> | |
| private var array: [Element] |
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 SwiftUI | |
| import Combine | |
| @propertyWrapper | |
| struct Debounced<Value>: DynamicProperty { | |
| private class Box: ObservableObject { | |
| let value = PassthroughSubject<Value, Never>() | |
| @Published | |
| private(set) var debounced: Value |
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 SwiftUI | |
| struct GridView: View { | |
| let columns: Int | |
| let columnAlignment: VerticalAlignment | |
| let rowAlignment: HorizontalAlignment | |
| let rowSpacing: CGFloat? | |
| let columnSpacing: CGFloat? | |
| let content: [AnyView] |
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 Combine | |
| import SwiftUI | |
| extension View { | |
| func binding(@CancellableBuilder bindings: @escaping () -> AnyCancellable) -> some View { | |
| return BindingView(content: AnyView(self), bindings: bindings) | |
| } | |
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
| fileprivate let badChars = CharacterSet.alphanumerics.inverted | |
| extension String { | |
| var uppercasingFirst: String { | |
| return prefix(1).uppercased() + dropFirst().lowercased() | |
| } | |
| var lowercasingFirst: String { | |
| return prefix(1).lowercased() + dropFirst().lowercased() | |
| } |
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 | |
| enum ComparisonResult { | |
| case equal | |
| case larger | |
| case smaller | |
| } | |
| extension Comparable { |
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 'dart:async'; | |
| import 'package:flutter/material.dart'; | |
| class Property<Value> implements Sink<Value> { | |
| Value _internalValue; | |
| final StreamController<Value> _streamController = StreamController.broadcast(); | |
| Value get value { |
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 | |
| let fb = [ | |
| 3 : "Fizz", | |
| 5 : "Buzz", | |
| 6 : "Fizz", | |
| 9: "Fizz", | |
| 10: "Buzz", | |
| 12: "Fizz", |
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 SystemConfiguration.CaptiveNetwork | |
| func ssid() -> String? { | |
| let interfaces = CNCopySupportedInterfaces() as [AnyObject]? | |
| let interfaceNames = interfaces?.map { $0 as! CFString } | |
| let interfaceDictionaries = interfaceNames?.flatMap { CNCopyCurrentNetworkInfo($0) as? [String : AnyObject] } | |
| return interfaceDictionaries?.flatMap { $0[kCNNetworkInfoKeySSID as String] as? String } | |
| .first | |
| } |