Skip to content

Instantly share code, notes, and snippets.

View meyusufdemirci's full-sized avatar

Yusuf Demirci meyusufdemirci

View GitHub Profile
class KeychainManager {
// MARK: Properties
static let shared = KeychainManager()
subscript(key: String) -> String? {
get {
return get(key: key)
} set {
DispatchQueue.global().sync(flags: .barrier) {
class func uniqueId(length: Int) -> String {
let letters: String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
return String((0 ..< length).map { _ in letters.randomElement()! })
}
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
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
}()
{
"isSuccess": true,
"message": "",
"data": {
"mins": 5,
"price": "7200"
}
}
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 {
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?
struct AveragePriceResponseModel: Codable {
// MARK: - Properties
var mins: Int?
var price: String?
// {"mins":5,"price":"6766.01484782"}
}
class AveragePriceRequestModel: RequestModel {
// MARK: - Properties
private var symbol: String
init(symbol: String) {
self.symbol = symbol
}
override var path: String {
class RequestModel: NSObject {
// MARK: - Properties
var path: String {
return ""
}
var parameters: [String: Any?] {
return [:]
}
var headers: [String: String] {