dtrenz / LaunchGate

LaunchGate makes it easy to let users know when an update to your app is available.
http://dtrenz.github.io/LaunchGate
Other
60 stars 16 forks source link

Config JSON parsing completed. #11

Closed dtrenz closed 8 years ago

dtrenz commented 8 years ago

Includes

If the developer/consumer wants to use the default configuration JSON file format, the built-in parser will be used (LaunchGateDefaultParser).

If the dev wants or needs to use a custom formatted JSON file, they will need to implement their own parser class that conforms to the LaunchGateParser protocol, and set an instance of the custom parser on the LaunchGate instance.

Example:

import LaunchGate

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?

  lazy var launchGate = LaunchGate(uri: "https://www.example.com/config.json")

  func applicationDidBecomeActive(application: UIApplication) {
    // optional; only required if using a custom config JSON format
    launchGate.setParser(MyCustomParser())
    launchGate.performCheck()
  }

}

Closes #2

stkent commented 8 years ago

Needs merge!

stkent commented 8 years ago

Happy to merge this now, but I would need write access to be able to do so :)

dtrenz commented 8 years ago

@stu Plz hold, updates incoming!

dtrenz commented 8 years ago

Yes, in order to get Swift to auto-generate a member-wise init method: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-ID214

I feel like you should be allowed to use let constants for this, too, but the compiler disagreed.

stkent commented 8 years ago

Huh, TIL that!

dtrenz commented 8 years ago

Gave up on running tests in Travis CI. :disappointed:

stkent commented 8 years ago

:/

dtrenz commented 8 years ago

OK – assuming the CI build passes – this PR should be good to merge.