https://www.avanderlee.com/ 有几篇还不错的可以拿来用的代码
https://www.swiftbysundell.com/ 有很多值得学习的编程思想
https://www.vadimbulavin.com/ 推荐他的底层原理系列文章
https://www.avanderlee.com/ 有几篇还不错的可以拿来用的代码
https://www.swiftbysundell.com/ 有很多值得学习的编程思想
https://www.vadimbulavin.com/ 推荐他的底层原理系列文章
// https://www.avanderlee.com/swift/asynchronous-operations/ | |
class AsyncOperation: Operation { | |
private let lockQueue = DispatchQueue(label: "com.swiftlee.asyncoperation", attributes: .concurrent) | |
override var isAsynchronous: Bool { | |
return true | |
} | |
private var _isExecuting: Bool = false |
// https://www.avanderlee.com/swift/authentication-alamofire-request-adapter/ | |
/// The storage containing your access token, preferable a Keychain wrapper. | |
protocol AccessTokenStorage: class { | |
typealias JWT = String | |
var accessToken: JWT { get set } | |
} | |
final class RequestInterceptor: Alamofire.RequestInterceptor { |
//https://developer.apple.com/videos/play/wwdc2019/212 | |
extension UserDefaults { | |
private static let isInfoBarHiddenKey = "IsInfoBarHidden" | |
@objc dynamic var isInfoBarHidden: Bool { | |
get { bool(forKey: UserDefaults.isInfoBarHiddenKey) } | |
set { set(newValue, forKey: UserDefaults.isInfoBarHiddenKey) } | |
} | |
} |
//https://stackoverflow.com/a/58518282/4819236 | |
extension CALayer { | |
var areAnimationsEnabled: Bool { | |
get { delegate == nil } | |
set { delegate = newValue ? nil : CALayerAnimationsDisablingDelegate.shared } | |
} | |
} | |
private class CALayerAnimationsDisablingDelegate: NSObject, CALayerDelegate { |
import UIKit | |
class FixControlTouchScrollView: UIScrollView { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
delaysContentTouches = false | |
} | |
required init?(coder: NSCoder) { | |
super.init(coder: coder) |