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
final class Storage<StoredValue> { | |
private var storage: [StoredValue] = [] | |
func addFailingValue<T: ModelRepresentable>(_ model: T) where T.Model == StoredValue { | |
self.storage.append(model.value) | |
} | |
func addValue<T: ModelRepresentable>(_ model: T) { | |
guard let value = model.value as? StoredValue else { return } | |
self.storage.append(value) |
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
[ | |
{ | |
"date": { | |
"duration": 244799, | |
"start": 1522900800 | |
}, | |
"id": "rwdevcon-2018", | |
"name": "RWDevCon 2019", | |
"sessions": [ | |
{ |
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
let formatter = NSDateFormatter() | |
formatter.dateStyle = .NoStyle | |
formatter.timeStyle = .FullStyle | |
formatter.timeZone = NSTimeZone(name: "America/Los_Angeles") | |
print("1 \(formatter.stringFromDate(NSDate()))") | |
formatter.timeZone = NSTimeZone(name: "America/Chicago") | |
print("2 \(formatter.stringFromDate(NSDate()))") |
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
- (CGSize)intrinsicContentSize { | |
__block CGFloat minX = CGFLOAT_MAX; | |
__block CGFloat maxX = CGFLOAT_MIN; | |
__block CGFloat minY = CGFLOAT_MAX; | |
__block CGFloat maxY = CGFLOAT_MIN; | |
[[self subviews] enumerateObjectsUsingBlock:^(UIView *subview, NSUInteger idx, BOOL *stop) { | |
// Ignore _UILayoutGuide | |
if (![subview conformsToProtocol:@protocol(UILayoutSupport)]) { | |
// We could use CGRectGet(Min|Max)(X|Y) using the subview.frame, but subview.frame is undefined when a transform is applied. This calculation is transform-friendly. |