https://gist.github.com/lalkrishna/c1b33cba4dbacddbc1ecc9d619877c42
-
Project settings -> Select Framework Target -> Build settings add
-fembed-bitcode
in Other C Flags -
click + Button -> Add User-Defined Setting Key: BITCODE_GENERATION_MODE
// MARK: - Usage | |
func application(_ application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { | |
UIFont.registerAllCustomFonts() | |
// Or You can add manually, | |
// https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app | |
return true | |
} | |
// Using Default family name |
import UIKit | |
class SelfSizedTableView: UITableView { | |
var maxHeight: CGFloat = UIScreen.main.bounds.size.height | |
override func reloadData() { | |
super.reloadData() | |
self.invalidateIntrinsicContentSize() | |
self.layoutIfNeeded() | |
} |
https://gist.github.com/lalkrishna/c1b33cba4dbacddbc1ecc9d619877c42
Project settings -> Select Framework Target -> Build settings
add -fembed-bitcode
in Other C Flags
click + Button -> Add User-Defined Setting Key: BITCODE_GENERATION_MODE
/* 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. |
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 | |
} |
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 | |
} |
import Foundation | |
import Alamofire | |
import UIKit | |
typealias ResponseType = Decodable | |
typealias AFResponse<Response: Decodable> = Alamofire.DataResponse<ApiResponse<Response>, AFError> | |
struct AFNetwork: NetworkService { | |
static func cancelAllRequests() { |
// | |
// HTMLBuilder.swift | |
// HTMLBuilder | |
// | |
// Created by Lal Krishna on 11/03/22. | |
// Copyright © 2022 Lal Krishna. All rights reserved. | |
// | |
import Foundation | |
import UIKit |