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
func animation(from notification: Notification) -> Animation? { | |
guard | |
let info = notification.userInfo, | |
let duration = info[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double, | |
let curveValue = info[UIResponder.keyboardAnimationCurveUserInfoKey] as? Int, | |
let uiKitCurve = UIView.AnimationCurve(rawValue: curveValue) | |
else { | |
return nil | |
} |
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
/// TrackedValue is a property wrapper that allows you to work around the | |
/// lack of didSet when working with SwiftUI. | |
/// Explanation and example usage at: https://stackoverflow.com/a/60145397/467209 | |
@propertyWrapper | |
struct TrackedValue<Tracked, Value>: DynamicProperty { | |
var trackedHolder: State<ValueHolder<Tracked>> | |
var valueHolder: State<ValueHolder<Value>> | |
init(wrappedValue value: Value, tracked: Tracked) { | |
self.trackedHolder = State(initialValue: ValueHolder(tracked)) |
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
struct StateUpdatedPreferenceKey: PreferenceKey { | |
static var defaultValue: Int = Int.min | |
static func reduce(value: inout Int, nextValue: () -> Int) { | |
value = nextValue() | |
} | |
} | |
struct StateUpdated: 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
// | |
// GeometryFinder.swift | |
// | |
// Created by Timothy Costa on 2019/06/24. | |
// Copyright © 2019 timothycosta.com. All rights reserved. | |
// | |
import SwiftUI | |
struct RectPreferenceKey: PreferenceKey { |
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
// | |
// CADisplayLinkBinding.swift | |
// lingq-5 | |
// | |
// Created by Timothy Costa on 2019/07/11. | |
// Copyright © 2019 timothycosta.com. All rights reserved. | |
// | |
import Combine | |
import SwiftUI |
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
// | |
// UIScrollViewWrapper.swift | |
// lingq-5 | |
// | |
// Created by Timothy Costa on 2019/07/05. | |
// Copyright © 2019 timothycosta.com. All rights reserved. | |
// | |
import SwiftUI |
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
struct ViewControllerHolder { | |
weak var value: UIViewController? | |
init(_ value: UIViewController?) { | |
self.value = value | |
} | |
} | |
struct ViewControllerKey: EnvironmentKey { | |
static var defaultValue: ViewControllerHolder { return ViewControllerHolder(UIApplication.shared.windows.first?.rootViewController ) } |
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
// | |
// UIViewWrapper.swift | |
// lingq-5 | |
// | |
// Created by Timothy Costa on 2019/06/14. | |
// Copyright © 2019 timothycosta.com. All rights reserved. | |
// | |
import SwiftUI | |
import UIKit |
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
Fatal Exception: RLMException | |
0 CoreFoundation 0x1841badb0 __exceptionPreprocess | |
1 libobjc.A.dylib 0x18381ff80 objc_exception_throw | |
2 Realm 0x100b6e300 RLMGetArray(RLMObjectBase*, unsigned long) (RLMAccessor.mm:212) | |
3 LingQ 0x1000bdaf0 -[GCCellFactory configureCell:forLesson:locked:feed:] (GCCellFactory.m:173) | |
4 LingQ 0x1000f0188 -[LQTableViewController configureCell:section:row:] (LQTableViewController.m:353) | |
5 LingQ 0x1000effec -[LQTableViewController configuredCellForTableView:row:indexPath:] (LQTableViewController.m:342) | |
6 LingQ 0x1000f086c -[LQTableViewController tableView:cellForRowAtIndexPath:] (LQTableViewController.m:421) | |
7 UIKit 0x18966f030 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] | |
8 UIKit 0x18966f198 -[UITableView _createPreparedCellForGlobalRow:willDispla |
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
Fatal Exception: RLMException | |
0 CoreFoundation 0x1821821c0 __exceptionPreprocess | |
1 libobjc.A.dylib 0x180bbc55c objc_exception_throw | |
2 Realm 0x1009f6954 ___ZL17RLMAccessorGetterP11RLMProperty15RLMAccessorCode_block_invoke_2 (RLMAccessor.mm:308) | |
3 iLingQ 0x1001b149c __52-[FeedSearchViewController importDetailsForLessons:]_block_invoke (FeedSearchViewController.m:241) | |
4 Objective_Shorthand 0x1009aa198 __67-[NSArray(FunctionalMethods) arrayByTransformingObjectsUsingBlock:]_block_invoke (NSArray+FunctionalMethods.m:34) | |
5 CoreFoundation 0x18206f1a4 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke | |
6 CoreFoundation 0x18206f010 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] | |
7 Objective_Shorthand 0x1009aa134 -[NSArray(FunctionalMethods) arrayByTransformingObjectsUsingBlock:] (NSArray+FunctionalMethods.m:40) | |
8 iLingQ 0x1001b12c |
NewerOlder