Fashion is a powerful and flexible library for styling your iOS applications. Whether you are building a simple prototype or a sophisticated production app, Fashion provides a comprehensive set of tools to make styling enjoyable and efficient.
Features
- π¨ Powerful and flexible styling capabilities
- π Intuitive and easy-to-use API
- π Cross-platform support for iOS and macOS
- π¦ Extensive library of predefined styles
- π‘ Integration with popular design systems
- ποΈ Built-in support for dynamic type and dark mode
- π Comprehensive documentation and guides
Getting Started
To begin using Fashion in your project, follow these simple steps:
- Install Fashion using CocoaPods or Swift Package Manager
- Create your first style sheet file
- Define styles and apply them to your UI components
Installation
To install Fashion in your project, you can use either CocoaPods or Swift Package Manager.
pod 'Fashion'
or
.package(url: "https://github.com/some/url", from: "1.0.0")
Stylesheets
After installing Fashion, create a new file in your project called StyleSheet.swift
. This file will contain all your styles.
// StyleSheet.swift
import Fashion
public enum MyStyles: String, StyleConvertible {
case primaryButton
case secondaryButton
// Define your styles here
public func build() -> Fashion.Style {
switch self {
case .primaryButton:
return [
.backgroundColor(.blue),
.cornerRadius(8),
.foregroundColor(.white),
// Add more style properties as needed
]
case .secondaryButton:
return [
.backgroundColor(.gray),
.cornerRadius(8),
.foregroundColor(.darkGray),
// Add more style properties as needed
]
}
}
}
Usage
To apply a style to a UI component, simply call the apply(style:)
method on the component, passing the desired style.
// ViewController.swift
import Fashion
class ViewController: UIViewController {
private lazy var button: UIButton = {
let button = UIButton()
button.setTitle("Submit", for: .normal)
// Apply the 'primaryButton' style to the button
button.apply(style: MyStyles.primaryButton)
return button
}()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(button)
// Add constraints and layout code
}
}
Examples
Here are some examples of what you can achieve with Fashion:
- π¨ Create consistent color schemes
- π Define reusable typography settings
- π Implement adaptive layouts for dynamic type and dark mode
- π§ Customize your UI components with ease
- π Integration with popular third-party libraries
Documentation
For detailed usage instructions, API reference, and examples, check out the Fashion documentation.
With Fashion, you can take your app’s styling to the next level. Try it now and experience the joy of easy and efficient styling in your iOS projects!