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 RxSwift | |
| import RxCocoa | |
| import RxRelay | |
| extension Disposable { | |
| public func wrapIntoAnyDisposable() -> AnyDisposable { | |
| return AnyDisposable(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 CoreGraphics | |
| final class TransactionStack { | |
| static let shared = TransactionStack() | |
| private var _transactions: [Transaction] | |
| private init() { | |
| dispatchPrecondition(condition: .onQueue(.main)) | |
| _transactions = [] |
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 struct _CompletionPreferenceKey: PreferenceKey { | |
| typealias Value = CGFloat | |
| static let defaultValue: CGFloat = 0 | |
| static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { | |
| value = nextValue() | |
| } | |
| } |
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 Combine | |
| import SwiftUI | |
| @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) | |
| @propertyWrapper | |
| public struct Model<Value>: DynamicProperty { | |
| final class _Box: ObservableObject { | |
| let objectWillChange = ObservableObjectPublisher() | |
| var value: 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 | |
| class Base: CustomDebugStringConvertible { | |
| var debugDescription: String { | |
| "\(type(of: self)) \(ObjectIdentifier(self))" | |
| } | |
| init() { | |
| print("🟢 init\t", 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
| // BUG: FB7569572 | |
| struct GeometrySizeKey: PreferenceKey { | |
| static func reduce(value: inout CGSize?, nextValue: () -> CGSize?) { | |
| value = nextValue() | |
| } | |
| } | |
| extension View { | |
| func readGeometrySize() -> some View { |
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
| struct PKey: PreferenceKey { | |
| static var defaultValue: Int? | |
| static func reduce(value: inout Int?, nextValue: () -> Int?) { | |
| print(#function, "value:", value as Any, "nextValue:", nextValue() as Any) | |
| value = nextValue() | |
| } | |
| } | |
| struct ContentView: View { | |
| let condition = true |
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
| // This code uses 3 HIDDEN SwiftUI types, there is no guarantee | |
| // that it will pass app review, so please use it with caution. | |
| // | |
| // * SwiftUI._PreferenceValue<Key> | |
| // * SwiftUI._DelayedPreferenceView<Key, Content> | |
| // * SwiftUI._PreferenceValue<Key> | |
| // | |
| // Feedback ID for an official support: (FB7577482) | |
| // | |
| // ⚠️ WARNING: |
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
| // SOME OBSERVATIONS: | |
| // * In Xcode 11.3.1 `V_Struct_Representable_ObservedObject` won't update | |
| // which is clearly a bug. This bug is fixed in Xcode 11.4 beta 1. | |
| // | |
| // * `V_Struct` and `V_Struct_Representable` both never update because | |
| // they shouldn't as the framework internal raw-diffing likely won't | |
| // identify any change. (EXPECTED BEHAVIOR) | |
| // | |
| // * `V_Class` and `V_Class_ObservedObject` both produce a runtime crash, | |
| // which might be a bug as well. `View` conforming types shouldn't be |