Traits allows you to modify the design and behavior of native iOS apps without having to restart them, even across the globe.
Wouldn't it be great if we could adjust designs of our native apps without having to sit back to Xcode, change code, recompile and navigate back to the screen we were at?
Traitsis a library that provides you the ability to change many properties of your apps (not only design) without having to recompile the application, even via network across the globe.
Using it offers many benefits:
Article describing design and implementation details of this tool
view.traitSpec = "article.containerView"
or via interface builder:
While running on simulator you can observe file on your desktop:
TraitsProvider.setupDesktopDaemon()
While running on device, you can observe remote URL:
TraitsProvider.setupRemoteDaemon(url: myFileURL)
Traits
supports extending the library in real-time, without even having to recompile your project and without unsigning your Xcode 8 .
Just install Injection app and code away:
Adding new Trait
that is specific to your project is really simple:
Trait
apply
function that returns a reversal closure ObjectMapper
final public class Constraint: Trait { private(set) var constant: CGFloat? open override class var restrictedTypes: [AnyClass]? { return [NSLayoutConstraint.self] } open override func apply(to target: Trait.Target, remove: inout RemoveClosure) throws { let target = target as! NSLayoutConstraint remove = { [weak target, constant = target.constant] in guard let target = target else { return } target.constant = constant } if let constant = constant { target.constant = constant } } public init(constant: CGFloat) { super.init() self.constant = constant } public required init?(map: Map) { super.init(map: map) } open override func mapping(map: Map) { super.mapping(map: map) constant <- map["constant"] } }
This library requires a deployment target of iOS 8.0 or greater.
Traits is available through CocoaPods .
To install it, simply add the following line to your Podfile:
pod "Traits"
Created byKrzysztof Zabłocki ( twitter | website ) during Maker Week at The New York Times
Article describing design and implementation details of this tool
Contributions to Traits are welcomed and encouraged! Please see theContributing guide.
A list of contributors is available through GitHub.
To give clarity of what is expected of our members, we adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities, and we think it articulates my values well. For more, see theCode of Conduct.
Traits is available under the MIT license. SeeLICENSE for more information.
This tool is powered by
Thank you goes to:
Make sure to check my other libraries and tools, especially:
You can follow me on twitter for news/updates about other projects I am creating.