To run the example project, clone the repo, and run pod install
from the Example directory first.
- iOS 9.0+
- File "Pods-acknowledgement.plist" located in Target's Pods directory.
DevOptions is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'DevOptions'
-
Add the "Pods-acknowledgement.plist" file to your project. You can find this file in the Pods directory of your target (Pods -> Target Support Files -> Pods-YourTarget). Ensure that the file is in the "Copy Bundle Resources" of your target project. Note: Until a future version, you'll need to do this manually each time you update your Pods.
-
Configure the Pod in AppDelegate's didFinishLaunchingWithOptions:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let configurations = DevOptionsConfigurations()
configurations.companyLogo = UIImage(named: "company_logo")
configurations.companyWebsite = "https://www.nomadesolutions.com/"
configurations.password = "1234"
//configurations.mainStoryboardName = "Main" //In case you use storyboards
//Other configurations are already set, but available for customization
DevOptions.configure(configurations, baseUrls: [UIApplication.serverBaseUrl(), UIApplication.otherBaseUrl()]) {
/*
What you want to do when the Developper Mode is activated or deactivated
*/
// To update DevOptions view controller.
DevOptions.baseUrls = [UIApplication.serverBaseUrl(), UIApplication.otherBaseUrl()]
}
return true
}
- Add the EndorsementView to your UI:
Programmatically:
let endorsementView = EndorsementView()
view.addSubview(endorsementView)
endorsementView.snp.makeConstraints { (make) in
make.left.equalTo(view.snp.left)
make.right.equalTo(view.snp.right)
make.bottom.equalTo(view.snp.bottom)
}
or:
let endorsementView = EndorsementView(CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 60))
view.addSubview(endorsementView)
From Storyboard: Set a custom class for your view (Class: EndorsementView, Module: DevOptions). XCode should select the module automatically.
- Ensure to set your localized texts in ViewDidLoad, and optionally page tags.
override func viewDidLoad() {
super.viewDidLoad()
title = NSLocalizedString("welcome.navigation_bar.title", comment: "")
pageTag = "welcome"
let informationLabel = UILabel()
informationLabel.text = NSLocalizedString("welcome.label.information", comment: "")
//...
settingsButton = UIButton(type: .system)
settingsButton.setTitle(NSLocalizedString("welcome.button.settings", comment: ""), for: .normal)
//...
}
- Access the DevOptions by long pressing both company and licenses logos.
Nomade Solutions Mobiles, [email protected]
DevOptions is available under the MIT license. See the LICENSE file for more info.