DevOptions 0.4.2

DevOptions 0.4.2

Maintained by Mathieu Juneau, William Simard, PierreNomade, Mathieu Juneau.



 
Depends on:
TRZSlideLicenseViewController>= 0
Toast-Swift>= 0
SnapKit>= 0
 

  • By
  • Nomade Solutions Mobiles

DevOptions

Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 9.0+
  • File "Pods-acknowledgement.plist" located in Target's Pods directory.

Installation

DevOptions is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DevOptions'

Usage

  1. 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.

  2. 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
}
  1. 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.

  1. 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)
    //...
}
  1. Access the DevOptions by long pressing both company and licenses logos.

Author

Nomade Solutions Mobiles, [email protected]

License

DevOptions is available under the MIT license. See the LICENSE file for more info.