Releases: MihaelIsaev/UIKitPlus
Improve root controller to support scenes
RootController: implement attach(to scene:)
now in SceneDelegate file you could attach RootController like this
@available(iOS 13.0, *)
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let _ = (scene as? UIWindowScene) else { return }
RootViewController().attach(to: scene) // it returns Window and you could store it if you want to
}
}without SceneDelegate you could attach RootController in AppDelegate like this
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var rootViewController: RootViewController { window!.rootViewController as! RootViewController }
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
RootViewController().attach(to: window)
return true
}
}Live preview! 🎉
Let's imagine that you already have MyViewController in your project
create e.g. Live.swift, paste this code, enable canvas Cmd+Opt+Enter and pin this canvas
#if canImport(SwiftUI) && DEBUG
import SwiftUI
import UIKitPlus
@available(iOS 13.0, *)
struct DemoView_Preview: PreviewProvider {
static var previews: some SwiftUI.View {
MyViewController()
.liveView
.previewDevice(PreviewDevice(rawValue: "iPhone X"))
.edgesIgnoringSafeArea(.vertical)
}
}
#endifgo to MyViewController and enjoy with live preview!
Then just replace MyViewController() to somethings else to switch to preview for another view controller or view.
Finally started working on v1.0
This release still support iOS9+ but it works with Swift 5.1+ only because of function builders and property wrappers 🚀
Readme will be updated soon! Stay tuned!
P.S. If you can't wait write me a message on discord or take a look at commits.
Localization feature
Now you're able to localize any string with any locale.
let myString = String(
.en("Hello"),
.fr("Bonjour"),
.ru("Привет"),
.es("Hola"),
.zh_Hans("你好"),
.ja("こんにちは"))
print(myString) // it will print string relative to your current localeIf somehow current language will no be detected it will use default language which is located in Localization.default and you can change it in runtime to anything you want.
Also you are able to change current language to anything you want by setting Localization.current
New things
- Implement declarative
UIPickerView - Implement declarative
UIDatePicker - Implement extension to set different numeric values for different device models
let width: CGFloat = 100 !! .iPhone5(60) !! .iPhone6(70) !! .iPhone6Plus(85)- Implement declarative
BarButtonItem - Implement declarative
TableViewCell - Implement declarative
InputView - TextField: add ability to set
inputView - TextField: add an ability to add multiple callbacks for methods like
didBeginEditing,didEndEditing,editingChanged - TabViewController: mark as
open - UIView+Add: add method with [UIView] in addition to variadic
- Label: add ability to set attributed text after initialization
- TableView: implement a lot of useful methods
- TableView: fix initialization issues
- ScrollView: add convenience initializers
- ScrollView: add
delegatemethod - WrapperView: fix issue when shadow doesn't work with custom rounded corners
- WrappedViewControlelr: parent view is not generic anymore
Critical fixes and pleasant improvements
- Fix crossconstraints issue when views are added out of order
NavigationControllerallow to settintcolorNavigationControllerallow to hidenavigationBarNavigationControllerallow to enable/disableswipeBackViewControllerimprove keyboard appearance handlers logic- Fix
corners+shadowissue ViewadddiscardableResulttosubviewsmethodViewimprovetapActionButtonViewaddmodemethod- Add
subviewsmethod toStackView - Improve
VerificationCodeView TextFieldViewadd simpleshouldReturnmethodTextFieldViewadd ability to add left and right viewsTextFieldViewreplaceTextFieldwithSelfin all returns- Improve
SegmentedControl - Implement
ContentInsetAdjustmentenum forCollectionView - Extend
DeclarativeProtocolby adding one morecornersmethod - Add
centerXtoDeclarativeConstraintXSide - Extend
DeclarativeProtocolwith bounds methods - Extend
NavigationControllerwith animatedpushandpopmethods - Implement
concatoperator forAttributedString - Extend
UIImagewith convenienceblurredmethod - Extend
UIImagewith convenienceresizemethod - Implement
ImpactFeedback - Extend
UIDevicewith few convenience methods - Add ability to print all fonts
- Fix constraint operators