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

Extensions #83

Open
ivlevAstef opened this issue Mar 25, 2017 · 2 comments
Open

Extensions #83

ivlevAstef opened this issue Mar 25, 2017 · 2 comments
Labels

Comments

@ivlevAstef
Copy link
Owner

ivlevAstef commented Mar 25, 2017

Extensions - add additional capabilities, in runtime. Needs for other libraries

class VC: UIViewController {
  var presenter: Presenter!
}

// where get arg1?
class Presenter {
  let server: Server!
  let arg1: Int
  init(server: server, arg1: Int) {
    self.server = server
    self.arg1 = arg1
  }
}

showVC() {
  let runtimeArg1 = 125
  let runtimeArg2 = 125
  // extension variable need for retain Extension
  let extension = DIExtensions.resolve(filter: Presenter.self) { container in
    return Presenter(server: try! *container, arg1: runtimeArg1)
  } // if somebody resolve Presenter, then call extension
  // or
  let extension = DIExtensions.initial(filter: Presenter.self) { container in
    return Presenter(server: try! *container, arg1: runtimeArg1)
  } // if from somewhere get Presenter, then call extension

  let extension = DIExtensions.postInit(filter: Presenter.self) { container, presenter in
    presenter.arg2 = runtimeArg2
  } // if Presenter full create, then call extension

  let vc = storyboard.in...()
}
@ivlevAstef
Copy link
Owner Author

only from version 3.0.0

@ivlevAstef ivlevAstef added this to the v3.0.0 milestone Mar 27, 2017
@ivlevAstef
Copy link
Owner Author

new idea - callback on register.
Summary:
callback initial
callback injection
replace initial
append postInjection

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

No branches or pull requests

1 participant