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
import Foundation | |
import Realm | |
import RealmSwift | |
public extension Realm { | |
func cascadeDelete(_ entity: RLMObjectBase) { | |
guard let entity = entity as? Object else { return } | |
entity.objectSchema.properties.forEach { property in |
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
import UIKit | |
class OnboardingManager { | |
private let userDefaults: UserDefaults | |
init(userDefaults: UserDefaults = .standard) { | |
self.userDefaults = userDefaults | |
} | |
func presentOnboardingControllerIfNeeded(in viewController: UIViewController) { |
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
import Foundation | |
import RealmSwift | |
protocol CascadingDeletable { | |
var cascadingDeletions: [AnyObject?] { get } | |
} | |
extension Realm { | |
func delete<T: AnyObject>(cascading: List<T>) where T: CascadingDeletable { |