Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UsageGuide.md #576

Merged
merged 2 commits into from
Apr 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/UsageGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,33 @@
2. Enable Hero for the destination view controller

```swift
viewController.isHeroEnabled = true
viewController.hero.isEnabled = true
```

### UINavigationController & UITabBarController

Hero also supports transitions within a navigation controller or a tab bar controller—just set the 'isHeroEnabled' attribute to true on the UINavigationController/UITabBarController instance.
Hero also supports transitions within a navigation controller or a tab bar controller—just set the 'hero.isEnabled' attribute to true on the UINavigationController/UITabBarController instance.

## Attributes
There are two important attributes to understand: `heroID` and `heroModifiers`. These are implemented as extensions (using associated objects) for `UIView`. Therefore, after the Hero library is imported, every `UIView` will have these two attributes.

| Attribute Name | Description |
| --- | --- |
| `heroID` | Identifier for the view. Hero will automatically transition between views with the same `heroID` |
| `heroModifiers` | Specifies the extra animations performed alongside the main transition. |
| `hero.modifiers` | Specifies the extra animations performed alongside the main transition. |

## HeroID

`heroID` is the identifier for the view. When doing a transition between two view controllers, Hero will search through all subviews for both controllers, and match any views with the same `heroID`. Whenever a pair is discovered, Hero will automatically transit the views from source state to destination state.

## HeroModifiers

Use `heroModifiers` to specify animations alongside the main transition. Checkout [HeroModifier.swift](https://github.com/lkzhao/Hero/blob/master/Sources/HeroModifier.swift) for available modifiers.
Use `hero.modifiers` to specify animations alongside the main transition. Checkout [HeroModifier.swift](https://github.com/lkzhao/Hero/blob/master/Sources/HeroModifier.swift) for available modifiers.

#### For example, to achieve the following effect, set the `heroModifiers` to be
#### For example, to achieve the following effect, set the `hero.modifiers` to be

```swift
view.heroModifiers = [.fade, .translate(x:0, y:-250), .rotate(x:-1.6), .scale(1.5)]
view.hero.modifiers = [.fade, .translate(x:0, y:-250), .rotate(x:-1.6), .scale(1.5)]
```
<!--- TODO: Fix broken image below --->
<img src="https://github.com/lkzhao/Hero/blob/master/Resources/heroTransition.gif?raw=true" width="300">
Expand All @@ -47,7 +47,7 @@ Note: For matched views, the target view's heroModifier will be used. The source

## HeroModifierString

This is a string value. It provides another way to set `heroModifiers`. It can be accessed through the storyboard.
This is a string value. It provides another way to set `hero.modifiers`. It can be accessed through the storyboard.

It must be in the following syntax:

Expand Down