- Support for multiple platforms in the same framework.
- Support for Swift, Objective-C and C.
- Support for dynamic frameworks and static libraries.
- Support for Swift Package Manager.
- End of fat binaries.
- Open Current framework project
protocol Instantiatable { | |
static var storyboard: Storyboard { get } | |
static func instantiate() -> Self | |
} | |
extension Instantiatable where Self: UIViewController { | |
static func instantiate() -> Self { | |
// swiftlint:disable force_cast | |
UIStoryboard(storyboard).instantiateViewController(withIdentifier: String(describing: Self.self)) as! Self | |
} |
extension Double { | |
func formattedAsCurrency(_ currencySymbol: String? = nil) -> String { | |
let formatter = NumberFormatter() | |
formatter.numberStyle = .currency | |
formatter.locale = Locale(identifier: "id_ID") | |
if let currencySymbol { | |
formatter.currencySymbol = currencySymbol | |
} | |
let price = NSNumber(value: self) |
extension UITableView { | |
func register<T: UITableViewCell>(_ cellClass: T.Type) { | |
register(T.self, forCellReuseIdentifier: String(describing: T.self)) | |
} | |
func reusableCell<T: UITableViewCell>(for indexPath: IndexPath) -> T { | |
// swiftlint:disable force_cast | |
dequeueReusableCell(withIdentifier: String(describing: T.self), for: indexPath) as! T | |
} | |
// | |
// HTMLBuilder.swift | |
// HTMLBuilder | |
// | |
// Created by Lal Krishna on 11/03/22. | |
// Copyright © 2022 Lal Krishna. All rights reserved. | |
// | |
import Foundation | |
import UIKit |
import Foundation | |
import Alamofire | |
import UIKit | |
typealias ResponseType = Decodable | |
typealias AFResponse<Response: Decodable> = Alamofire.DataResponse<ApiResponse<Response>, AFError> | |
struct AFNetwork: NetworkService { | |
static func cancelAllRequests() { |
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { | |
guard !searchText.isEmpty else { searchQuery(); return } | |
NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(searchQuery), object: nil) | |
perform(#selector(searchQuery), with: nil, afterDelay: 0.4) | |
} | |
@objc func searchQuery() { | |
guard let searchText = searchBar.text else { return } | |
// Call API | |
} |
protocol UnknownCase: RawRepresentable, CaseIterable where RawValue: Equatable & Codable { | |
static var unknownCase: Self { get } | |
} | |
extension UnknownCase { | |
init(rawValue: RawValue) { | |
let value = Self.allCases.first { $0.rawValue == rawValue } | |
self = value ?? Self.unknownCase | |
} |
/* SET */ | |
Container.shared.register(type: User.self, User()) | |
Container.shared.set(User(), forKey: "SecondUser") | |
/* GET */ | |
let sameUser = Container.shared.resolve(User.self) | |
let secondUser = Container.shared.get("SecondUser", of: User.self) | |
/* REMOVE */ | |
$user.deregister() // This will remove "User" from factory. |