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 RealmSwift | |
import Realm | |
protocol CascadeDeleting { | |
func delete<S: Sequence>(_ objects: S, cascading: Bool) where S.Iterator.Element: Object | |
func delete<Entity: Object>(_ entity: Entity, cascading: Bool) | |
} | |
extension Realm: CascadeDeleting { | |
func delete<S: Sequence>(_ objects: S, cascading: Bool) where S.Iterator.Element: Object { |
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
# addSubview | |
UIView.transition(with: self.view, duration: 0.25, options: [.transitionCrossDissolve], animations: { | |
self.view.addSubview(view) | |
}, completion: nil) | |
# removeFromSuperview | |
UIView.transition(with: self.view, duration: 0.25, options: [.transitionCrossDissolve], animations: { | |
subview.removeFromSuperview() | |
}, completion: 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
import Foundation | |
import Combine | |
enum HTTPMethod: String { | |
case put = "PUT" | |
case post = "POST" | |
case get = "GET" | |
case delete = "DELETE" | |
case head = "HEAD" | |
} |
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 WebKit | |
final class WebCacheCleaner { | |
class func clean() { | |
HTTPCookieStorage.shared.removeCookies(since: Date.distantPast) | |
print("[WebCacheCleaner] All cookies deleted") | |
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records 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
let gradient = CAGradientLayer() | |
gradient.frame = tableView.superview?.bounds ?? CGRectNull | |
gradient.colors = [UIColor.clearColor().CGColor, UIColor.clearColor().CGColor, UIColor.blackColor().CGColor, UIColor.blackColor().CGColor, UIColor.clearColor().CGColor, UIColor.clearColor().CGColor] | |
gradient.locations = [0.0, 0.15, 0.25, 0.75, 0.85, 1.0] | |
tableView.superview?.layer.mask = gradient | |
tableView.backgroundColor = UIColor.clearColor() |