Skip to content

Commit

Permalink
Update README.md to reflect code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cosmo committed Mar 17, 2019
1 parent 5537002 commit 71a0291
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Written in Swift 4.2.

## Usage

Pass your App-ViewController as a `rootViewController` parameter to `TinyConsole` to create the `TinyConsoleController`.
Wrap your Main ViewController inside of a `TinyConsoleController` like so:

```swift
TinyConsole.createViewController(rootViewController: MyMainViewController())
TinyConsoleController(rootViewController: MyMainViewController())
```

### Actions
Expand All @@ -33,10 +33,7 @@ TinyConsole.addMarker()
// Clear console
TinyConsole.clear()

// Set root view controller
TinyConsole.set(rootViewController: MyViewController())
```
> Calling `TinyConsole.set(rootViewController:)` will change the `rootViewController` of `TinyConsoleController` but hold the console content and gesture configurations, which means the text and gesture recognizers of the console view will remain the same.

### Gestures

Expand All @@ -47,22 +44,6 @@ By default, the gestures is configured as follows:
* 3 Finger Tap: Show Action Sheet to `Clear Console` and `Send Mail`
* Shake to toggle the console view. If you’re using the Simulator, press <kbd>⌃ ctrl</kbd>-<kbd>⌘ cmd</kbd>-<kbd>z</kbd>.

To customize the gestures, specify `withDefaultGestureConfiguration` as `false`

```swift
TinyConsole.createViewController(rootViewController: MyMainViewController(), withDefaultGestureConfiguration: false)

```

and add your own gesture recognizers

```swift
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(consoleTapped))
TinyConsole.addGestureRecognizer(tapGestureRecognizer)
```

> Calling `TinyConsole.useDefaultGestureConfiguration()` will remove all gesture recognizers from console view and add the default gesture recognizers.
## Implementation Example

Instead of
Expand All @@ -81,7 +62,7 @@ write
```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = TinyConsole.createViewController(rootViewController: MyMainViewController())
window?.rootViewController = TinyConsoleController(rootViewController: MyMainViewController())
window?.makeKeyAndVisible()
return true
}
Expand Down

0 comments on commit 71a0291

Please sign in to comment.