Enable autocomplete use resources in swift project.
まだハードコードで消耗してるの? ResourceKitで安全コーディング!
ResouceKit makes your code that uses write for resources:
Becomes clear
, nessary to cast and guessing easy what a method will return.Checked
, the mistaken character doesn't enter your app code.Autocompleted
, never have to exist hard code when using resource.
// Get ViewController
let storyboard = UIStoryboard(name: "Storyboard", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "XXXX") as! ViewController
// PerformSegue
performSegue(withIdentifier: "Open", sender: sender)
// Nib
let nib = UINib(nibName: "TableViewCell", bundle: nil)
let cell = nib.instantiate(withOwner: nil, options: nil)[0] as! TableViewCell
Please see ResouceKitDemo
for more information, or Examples.md
// Get ViewController
let viewController = ViewController.instanceFromStoryboard() // <- viewController is ViewController class.
// PerformSegue
performSegueOpen() // <- can write to use autocomplete.
// Nib
let cell = TableViewCell.Xib.view() // <- easy get instance.
After installing ResourceKit into your project, and build it. ResourceKit will correct any missing/changed/added resources.
ResouceKit supports resource types.
CocoaPods is the recommended way of installation, as this avoids including any binary files into your project.
- Add
pod 'ResourceKit'
to your Podfile and run pod install. - In Xcode: Click on your project in the file list, choose your target under TARGETS, click the Build Phases tab and add a New Run Script Phase by clicking the little plus icon in the top left.
- Drag the new Run Script phase above the Compile Sources phase and below Check Pods Manifest.lock, expand it and paste the following script:
"$PODS_ROOT/ResourceKit/ResourceKit"
- Build your project, in Finder you will now see a ResourceKit.generated.swift in the $SRCROOT-folder, drag the ResourceKit.generated.swift files into your project and uncheck Copy items if needed
- Download a ResourceKit , unzip it and put it your source root directory.
- In Xcode: Click on your project in the file list, choose your target under TARGETS, click the Build Phases tab and add a New Run Script Phase by clicking the little plus icon in the top left
- Drag the new Run Script phase above the Compile Sources phase, expand it and paste the following script: "$SRCROOT/ResourceKit"
- Build your project, in Finder you will now see a
ResourceKit.generated.swift
in the $SRCROOT-folder, drag theResourceKit.generated.swift
files into your project and uncheck Copy items if needed.
- Cocoapods support.
- Images support.
- LocaliazedString Support.
- Adjust indent.
- Collaboration SegueAddition.
- User Chose Generate Resource Support.
A. You can write import CustomView
to ResourceKit.generated.swift
.
And build again, but It's left import CustomView
!
ResourceKit is released under the MIT license. See LICENSE.txt for details.