Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simplisticated/start
App launch handler for iOS
https://github.com/simplisticated/start
swift uiapplication uiapplicationdelegate xcode
Last synced: 1 day ago
JSON representation
App launch handler for iOS
- Host: GitHub
- URL: https://github.com/simplisticated/start
- Owner: simplisticated
- License: apache-2.0
- Created: 2018-08-27T18:20:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-31T21:05:26.000Z (over 6 years ago)
- Last Synced: 2025-02-01T11:41:41.746Z (10 days ago)
- Topics: swift, uiapplication, uiapplicationdelegate, xcode
- Language: Swift
- Homepage:
- Size: 66.4 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
## At a Glance
`Start` is a tool that handles different things occurring on app launch.
## How To Get Started
- Copy content of `Source` folder to your project.
or
- Use `Start` cocoapod
## Requirements
* iOS 9 and later
* Xcode 9 and later
* Swift 4## Usage
### Launch count
In your `AppDelegate`, increment the number of launches stored by `Start` library:
```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// ...
Start.launches.increment()
// ...
return true
}
```Now you can retrieve number of app's launches:
```swift
let launchCount = Start.launches.count
```It's very easy to check if the app is launched for the first time:
```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// ...
Start.launches.increment()
// ...
switch Start.launches.count {
case 1:
// The first launch
break
default:
// Not the first launch
break
}
// ...
return true
}
```Sometimes you might need to reset the number of launches:
```swift
Start.launches.reset()
```## License
`Start` is available under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for more info.