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
| /// `ObjectBinding` used as a way to create a `Binding` from a `BindableObject`. In this case the ViewModel | |
| /// complies with `BindableObject` which is then translated into a `Binding` which is what `Toggle` is expecting | |
| /// NOTE: Since it's a `DynamicViewProperty`, after its value is changed, the body will be updated. | |
| class ViewModel: BindableObject { | |
| let didChange = PassthroughSubject<ViewModel, Never>() | |
| var isEnabled = false { | |
| didSet { | |
| didChange.send(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
| // | |
| // ContentView.swift | |
| // TestingMoreSwiftUI | |
| // | |
| // Created by Chris Eidhof on 04.06.19. | |
| // Copyright © 2019 Chris Eidhof. All rights reserved. | |
| // | |
| import SwiftUI | |
| import Combine |
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
| // UICollectionView Objective-C example | |
| - (void)viewWillAppear:(BOOL)animated { | |
| [super viewWillAppear:animated]; | |
| NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject]; | |
| if (selectedIndexPath != nil) { | |
| id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator; | |
| if (coordinator != nil) { | |
| [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
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 | |
| //: Swift type-safe protocol versions of (Mutable)Copying | |
| protocol SwiftCopying { | |
| associatedtype NonMutableType = Self | |
| func clone() -> NonMutableType | |
| } | |
| extension SwiftCopying where Self: NSCopying { | |
| func clone() -> NonMutableType { | |
| return self.copy() as! NonMutableType |
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
| // Public domain - https://gist.github.com/nolanw/dff7cc5d5570b030d6ba385698348b7c | |
| import Foundation | |
| extension URLRequest { | |
| /** | |
| Configures the URL request for `multipart/form-data`. The request's `httpBody` is set, and a value is set for the HTTP header field `Content-Type`. | |
| - Parameter parameters: The form data to set. |
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
| ------------ | |
| Conformances | |
| ------------ | |
| protocol AbsoluteValuable | |
| Conformances: | |
| Comparable | |
| IntegerLiteralConvertible | |
| SignedNumberType |
NewerOlder