Latest 1.0.4
Homepage https://github.com/yfben/YFUtils
License MIT
Platforms ios 9.0
Dependencies Localize-Swift
Authors

Author

yfben, [email protected]

Installation

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To 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'
end

Then, run the following command:

$ pod install

Usage

Internationalization

  1. Add Localizable.strings file and localize it with preferred language
  2. Subclass LocalizedViewController class
  3. Override setupLocalizedText() in the subclass
    override func setupLocalizedText() {
      // to localize "Localized title" string, append `.localized()` to it
      self.title = "Localized title".localized()
    }

Display message and error

alert(message: "message_button_message".localized(), type: .error)

Display loading view

// 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()

Reuse XIB in Strorybaord

  1. Design your reusable xib and create the corresponding swift file
  2. In the swift file
    • Subclass CustomView and mark it with @IBDesignable annotation
    • Mark designable property with @IBInspectable
    • Override setupCustomNib()
  3. In the storyboard file, set the Custom Class as the corresponding class
  4. In the xib file, set the Custom Class of File’s Owner as the corresponding class
  5. Enjoy it!!!

Latest podspec

{
    "name": "YFUtils",
    "version": "1.0.4",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "summary": "iOS common utilities",
    "homepage": "https://github.com/yfben/YFUtils",
    "authors": {
        "yfben": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yfben/YFUtils.git",
        "tag": "1.0.4"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "YFUtils/Classes/**/*.swift",
    "resources": "YFUtils/Resources/YFUtils.bundle",
    "dependencies": {
        "Localize-Swift": [
            "~> 2.0"
        ]
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This