Comments (4)
Storyboards control the lifecycle of all objects and I don't think it is possible to hook into it. Controller's do not consistently call init
internally either. Which means even if Objection were to overload init
it wouldn't guarantee the controller was instantiated properly.
There are a number of callback methods you can use to fallback on (awakeFromNib
for example) and use the default injector directly to inject your dependencies via the injectDependencies:
method.
from objection.
Fair enough, but is it possible to have injectDependencies:
inject THE Storyboard-created ViewController
into Objection-instantiated objects? At present, if you try to do this with Objection, no ViewController
s are found in the object cache and therefore a second ViewController
is created: not the behaviour we want!
i.e.
is there a way of obtaining a reference to the Storyboard-initialised ViewController
in a JSObjectionModule
definition such that we can call bind:toProtocol:
or bind:toClass:
onto it?
from objection.
Another way this could work is if Objection permits users to insert objects into the object cache, which then injectDependencies
uses. Setting up the correct delegates is a very useful use case...
from objection.
injectDependencies:
does not add to the injector context. It instead supplies the dependencies noted in objection_requires
to the object passed into it.
If you want a reference to that view controller via Objection you could build a new injector with that view controller via a module using the said approach above.
Conversely, you could use a provider where the provider has hooks for adding the storyboard created VC to it.
from objection.
Related Issues (20)
- Support setting properties of non-object types
- Does objection inject dependencies automatically on creation? HOT 2
- frida ๅฝไปค้่ฏฏ
- Compatibility with Swift HOT 3
- Reseting Objection's global context storage caches HOT 2
- Injection at Initialization HOT 3
- Inject property declared in a category.
- Sharing singleton scope when deriving a new injector HOT 1
- Ability to specify override objects HOT 5
- @objection_initializer not passing arguments HOT 2
- Injecting object with protocol and superclass
- about sample? HOT 1
- why not use modern objective-c
- Why "JSObjectionModule.m" file line fifth to write "#import <Objection/JSObjectionProviderEntry.h>", but not "#import "JSObjectionProviderEntry.h"".
- why JSObjectionEntry's injector property is "assign" not "weak"?
- Passing nil arguments for get objection object HOT 7
- inScope:JSObjectionScopeSingleton doesn't work since Cocoapods version 1.6 HOT 19
- Build is broken on XCode 6.4 HOT 4
- Getting a reference to the JSObjectionInjector which created an object? HOT 2
- Undeclared selector warnings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from objection.