UIKitのパラメータを共通化のConfigurationで設定できるライブラリです
This library allows you to set UIKit parameters in a common Configuration.
import UIKit
import UIKitConfiguration
// setup UILabel Configuration
var labelConfiguration = UILabel.UIKitConfiguration()
labelConfiguration[\.textColor] = .white
labelConfiguration[\.font] = UIFont.systemFont(ofSize: 18, weight: .bold)
labelConfiguration[\.numberOfLines] = 0
labelConfiguration[\.backgroundColor] = .black
// apply UILabelConfiguration to UILabel
let label1 = UILabel(uiKitConfiguration: labelConfiguration)
label1.text = "label1 with labelConfiguration applied."
let label2 = UILabel(uiKitConfiguration: labelConfiguration)
label2.text = "label2 with labelConfiguration applied."
// setup UIImageView Configuration
var imageViewConfiguration = UIImageView.UIKitConfiguration()
imageViewConfiguration[\.backgroundColor] = .black
imageViewConfiguration[\.contentMode] = .scaleAspectFit
imageViewConfiguration[\.image] = UIImage(systemName: "swift")
// apply UIImageViewConfiguration to UIImageView
let imageView1 = UIImageView(uiKitConfiguration: imageViewConfiguration)
let imageView2 = UIImageView(uiKitConfiguration: imageViewConfiguration)
// Various other classes of UIKitConfiguration are available...
Once you have your Swift package set up, adding ObservableUIKit as a dependency is as easy as adding it to the dependencies value of your Package.swift.
dependencies: [
.package(url: "https://github.com/sakiyamaK/UIKitConfiguration", .upToNextMajor(from: "0.0.1"))
]
To install ObservableUIKit package via Xcode
Go to File -> Swift Packages -> Add Package Dependency... Then search for https://github.com/sakiyamaK/UIKitConfiguration And choose the version you want
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate ObservableUIKit into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'UIKitConfiguration'