yfben, benxyz.chen@gmail.com
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapodsTo integrate YFUtils into your Xcode project using CocoaPods, specify it in your Podfile:
platform :ios, '9.0'
target '<Your Target Name>' do
use_frameworks!
pod 'YFUtils'
endThen, run the following command:
$ pod install- Add
Localizable.stringsfile and localize it with preferred language - Subclass
LocalizedViewControllerclass - Override
setupLocalizedText()in the subclassoverride func setupLocalizedText() { // to localize "Localized title" string, append `.localized()` to it self.title = "Localized title".localized() }
alert(message: "message_button_message".localized(), type: .error)// display localized string for "loading_view_title" for at least 2 seconds
LoadingView.show(message: "loading_view_title".localized(), duration: .milliseconds(Int(2.0 * 1000)))
LoadingView.hide()- Design your reusable xib and create the corresponding swift file
- In the swift file
- Subclass
CustomViewand mark it with@IBDesignableannotation - Mark designable property with
@IBInspectable - Override
setupCustomNib()
- Subclass
- In the storyboard file, set the Custom Class as the corresponding class
- In the xib file, set the Custom Class of File's Owner as the corresponding class
- Enjoy it!!!