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
class KeychainManager { | |
// MARK: Properties | |
static let shared = KeychainManager() | |
subscript(key: String) -> String? { | |
get { | |
return get(key: key) | |
} set { | |
DispatchQueue.global().sync(flags: .barrier) { |
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
class func uniqueId(length: Int) -> String { | |
let letters: String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | |
return String((0 ..< length).map { _ in letters.randomElement()! }) | |
} |
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
guard ( | |
appLaunchTime + 1 == 5 || | |
appLaunchTime + 1 == 8 || | |
appLaunchTime + 1 == 12 || | |
appLaunchTime + 1 == 15 || | |
appLaunchTime + 1 == 18 || | |
appLaunchTime + 1 == 21 || | |
appLaunchTime + 1 == 24 || | |
appLaunchTime + 1 == 27 || | |
appLaunchTime + 1 == 30 |
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
class HomeController: UIViewController { | |
// MARK: - Properties | |
private let infoLabel: UILabel = { | |
let label: UILabel = UILabel() | |
label.frame = CGRect(origin: CGPoint.zero, size: CGSize(width: UIScreen.main.bounds.width, height: 200)) | |
label.textAlignment = NSTextAlignment.center | |
return label | |
}() | |
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
{ | |
"isSuccess": true, | |
"message": "", | |
"data": { | |
"mins": 5, | |
"price": "7200" | |
} | |
} |
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
class ServiceManager { | |
// MARK: - Properties | |
public static let shared: ServiceManager = ServiceManager() | |
public var baseURL: String = "https://api.binance.com/api/v3" | |
} | |
// MARK: - Public Functions | |
extension ServiceManager { |
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 ResponseModel<T: Codable>: Codable { | |
// MARK: - Properties | |
var isSuccess: Bool | |
var message: String | |
var error: ErrorModel { | |
return ErrorModel(message) | |
} | |
var rawData: Data? | |
var data: T? |
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 AveragePriceResponseModel: Codable { | |
// MARK: - Properties | |
var mins: Int? | |
var price: String? | |
// {"mins":5,"price":"6766.01484782"} | |
} |
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
class AveragePriceRequestModel: RequestModel { | |
// MARK: - Properties | |
private var symbol: String | |
init(symbol: String) { | |
self.symbol = symbol | |
} | |
override var path: String { |
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
class RequestModel: NSObject { | |
// MARK: - Properties | |
var path: String { | |
return "" | |
} | |
var parameters: [String: Any?] { | |
return [:] | |
} | |
var headers: [String: String] { |