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
# put this file inside the root directory of the project | |
# update the framework name | |
frameworkName="MyFramework" | |
echo "⬛️ cleaning" | |
xcodebuild clean | |
rm -rf output | |
rm -rf build |


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
import Foundation | |
import UIKit | |
extension CustomView { | |
// can make private | |
static let storedProperties = WeakDictionary<UIView, Properties>() | |
struct Properties { | |
var url: 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
@IBDesignable | |
class UIViewXib: UIView { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
loadViewFromNib() | |
} | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) |
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
@IBDesignable | |
class UIViewXib: UIView { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
loadViewFromNib() | |
} | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) |
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
import UIKit | |
extension UITableView { | |
func dequeueReusableCell<T: UITableViewCell>(type: T.Type) -> T { | |
let identifier = String(describing: type) | |
if let reusableCell = self.dequeueReusableCell(withIdentifier: identifier) { | |
if let cell = reusableCell as? T { | |
return cell | |
} else { | |
assertionFailure("tableview cell cannot be casted to \(identifier)") |
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
import UIKit | |
extension UIView { | |
static func initViewFromNib() -> Self { | |
let nibName = String(describing: self) | |
let index = 0 | |
let view = Bundle.main.loadNibNamed(nibName, owner: nil, options: nil)![index] | |
if let castedView = view as? Self { | |
return castedView | |
} else { |
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
import UIKit | |
extension UIViewController { | |
// must override to provide storyboard | |
@objc class var fromStoryboard: UIStoryboard? { return nil } | |
// optional override to provide storyboardId | |
@objc class var storyboardId: String { return String(describing: self) } | |
static func instantiate() -> Self { |
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
@propertyWrapper | |
class UserDefaultsExtended<Type: Codable> { | |
let key: String | |
let loc: UserDefaults | |
var actualValue: Type? | |
init(key: String, loc: UserDefaults = UserDefaults.standard) { | |
self.key = key | |
self.loc = loc | |
} |
NewerOlder