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

Adding target for building Typhoon as a dynamic framework for iOS #290

Merged
merged 1 commit into from
Dec 9, 2014
Merged

Adding target for building Typhoon as a dynamic framework for iOS #290

merged 1 commit into from
Dec 9, 2014

Conversation

mowens
Copy link

@mowens mowens commented Dec 9, 2014

This will allow projects that build as dynamic framework (e.g. Swift libraries) to link against Typhoon as dynamic frameworks cannot link against static libraries (e.g. Cocoapods).

Included in this commit:

  • New build target called "Typhoon" that will build the Typhoon library as a cocoa dynamic framework :)
  • New build target called "TyphoonFrameworkSwiftExample" that will build an foobar iOS app that links against Typhoon.framework, sets up a simple TyphoonAssembly that injects a property into a view controller. A single unit test has been added to validate the property is injected when the view controller is instantiated from the storyboard (this test validates the library can be linked to and DI works as expected)

In order to get the target to build properly, several headers needed UIKit (wrapped with TARGET_OS_IPHONE) and Foundation imports to compile properly.

Instructions for including dynamic framework in projects and apps (NOTE: until Cocoapods suppots dynamic frameworks, this tends to be the best way)

  1. Include Typhoon as a git submodule
git submodule add https://github.com/typhoon-framework/Typhoon.git
  1. Drag and drop the Typhoon.xcodeproj into the project navigator
  2. Under your projects Build Phases, add the Typhoon.framework under the Target Dependencies
  3. Under your projects Build Phases, click the + button and create a New Copy Files Phase
  4. Name the new phase Copy Frameworks
  5. Set the destination to Frameworks
  6. Click the + and add Typhoon.framework to your new copy framework phase

screen shot 2014-12-08 at 10 06 55 pm

To use in a swift project (NOTE: you no longer need a bridging header :))

import Typhoon

public class Assembly: TyphoonAssembly {
    public dynamic func viewController() -> AnyObject {
        return TyphoonDefinition.withClass(ViewController.self) { definition in
            definition.injectProperty("foo", with: "bar")
        }
    }
}

will allow projects that build as dynamic framework (e.g. Swift
libraries) to link against Typhoon as dynamic frameworks cannot link
against static libraries (e.g. Cocoapods)
jasperblues added a commit that referenced this pull request Dec 9, 2014
Adding target for building Typhoon as a dynamic framework for iOS
@jasperblues jasperblues merged commit 95d7a60 into appsquickly:master Dec 9, 2014
@jasperblues
Copy link
Member

👍 Thanks @mowens :)

@jasperblues
Copy link
Member

@mowens Would you like push access to update the documentation?

@mowens
Copy link
Author

mowens commented Dec 9, 2014

@jasperblues sure thing :)

@mowens
Copy link
Author

mowens commented Dec 9, 2014

@jasperblues yes, ill go ahead and up the documentation once push access is granted. thanks!

@jasperblues
Copy link
Member

@mowens Granted. You may also push to the main (Typhoon Core) repo, or sample apps. The process is:

  • Create a ticket. Discuss any contentious issues.
  • Commit, and mark 'Ready for Review'

(Use own discretion to decide whether to push to master or a branch). What is your email address, will add you to Typhoon build server's spammer.

@mowens
Copy link
Author

mowens commented Dec 10, 2014

@jasperblues Sounds good. email: [email protected]

@mowens
Copy link
Author

mowens commented Dec 10, 2014

Hey @jasperblues I just attempted to push my changes to the wiki, but I do not have access to the wiki git repo:

https://github.com/typhoon-framework/Typhoon.wiki.git

Would you prefer the instructions in the README.md? I figured the Swift Quick Start would be the most ideal place

@jasperblues
Copy link
Member

You have to accept the invitation to push access. . . (its showing still pending).

Swift Quick Start sounds good, there's a link to that from the readme. Actually the Quick Start should be something that could be achieved in 2 minutes, so feel free to split that into:

  • Need to know this in order to see my first injection happen
  • Need to know this after I've gotten started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants