Skip to content

Commit

Permalink
Improves Installation and live reload guide
Browse files Browse the repository at this point in the history
  • Loading branch information
s4cha committed Feb 13, 2016
1 parent 75cd63e commit cebf0e4
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,22 @@ Stevia + [InjectionForXCode](http://injectionforxcode.com/) = <3 (WhoNeedsReactN

![Output sample](http://g.recordit.co/i6kQfTMEpg.gif)

In order to support live reload with InjectionForXCode, we simply need to tell our ViewController to rebuild a view after an injection occured.
- Download [InjectionForXCode](http://injectionforxcode.johnholdsworth.com/InjectionPluginV6.4.pkg)

- Install it, Launch it and Go to `File>Intall Plugins` (cmd+i)

- Restart Xcode and make sure to click `Load bundles` on the popup

In order to support **live reload** with InjectionForXCode, we simply need to tell our ViewController to rebuild a view after an injection occured.

in `viewDidLoad()` add :
```swift
on("INJECTION_BUNDLE_NOTIFICATION") {
self.v = CodeRequestView()
self.view = self.v
self.view = MyView()
}
```

Currently InjectionForXcode doesn't seem to swizzle "init" methods for some reason. So we have to move our view code in another methods
Currently InjectionForXcode doesn't seem to swizzle `init` methods for some reason. So we have to move our view code in another methods
```swift
convenience init() {
self.init(frame:CGRectZero)
Expand All @@ -301,18 +307,31 @@ func render() {

And Voila :)

Now you can launch the app and modify whatever you want in the `render()` method. simply hit ^= or `Product>Inject source` and you'll see your changes Live ! 🎉🎉🎉


## Installation

### Manual
Copy Stevia source files to your XCode project

### Carthage
```
github "s4cha/Stevia"
```

##Rationale behind the project
- Create a `Cartfile` file at the root of your project folder

- Add `github "s4cha/Stevia"` to your Cartfile

- Run `carthage update`

- Drag and drop `Stevia.framework` from `/Carthage/Build/iOS/` to Linked frameworks and libraries in Xcode (Project>Target>General>Linked frameworks and libraries)

- Add new run script (Project>Target>Build Phases>+> New run script phase) `/usr/local/bin/carthage copy-frameworks`

- Add Input files `$(SRCROOT)/Carthage/Build/iOS/Stevia.framework`

There you go!

## Rationale behind the project

On the [Yummypets](http://yummypets.com) app, we needed to deal with looooooots of views.
After trying different methods for building views (Xibs, Storyboards, Splitting Storyboards, React Native even(!).
Expand All @@ -324,7 +343,7 @@ That's why we created Stevia.
## Contributors

[YannickDot](https://github.com/YannickDot), [S4cha](https://github.com/S4cha), [Damien](https://github.com/damien-nd),
[Snowcraft](https://github.com/Snowcraft), [Mathieu-o]https://github.com/Mathieu-o
[Snowcraft](https://github.com/Snowcraft), [Mathieu-o](https://github.com/Mathieu-o)


## Other repos ❤️
Expand Down

0 comments on commit cebf0e4

Please sign in to comment.