Git Product home page Git Product logo

Comments (3)

Supereg avatar Supereg commented on May 30, 2024 1

Feedback as discussed in the meeting:

  • withDependencyResolution static function (with timeout overload)
  • Basic Lifecycle Handler Support (maybe flag based, default false)??

from spezi.

Supereg avatar Supereg commented on May 30, 2024 1

Completed as of #95

from spezi.

Supereg avatar Supereg commented on May 30, 2024

With recent changes in the Spezi framework, I wanted to provide some additional context to this issue.

The latest release of SpeziScheduler uses the following, greatly simplified setup to support the individual creation of Modules:

@testable import Spezi
@testable import SpeziScheduler

let scheduler = Scheduler<String>(tasks: [initialTasks])

// use the internal initializer to resolve dependencies via the `DependencyManager`
 _ = Spezi(standard: DefaultStandard(), modules: [scheduler])

// allow for async configuration of modules
try? await _Concurrency.Task.sleep(for: .seconds(0.1))

// use the `scheduler` ...

By making the Spezi import @testable, we gain access to the internal initializer of the Spezi type. This is great as it uses the exact same mechanisms as the spezi(_:) to resolve the dependency tree and doesn't rely on any unsafe usage of Mirror.

What is up to discussion is how we provide access to this API surface. Requiring a @testable import might not be the best option and the current initializer of the Spezi type is currently not really meant for external usage.

Further, some modules might do some asynchronous initialization after configuration. Certain users might want to wait for completion for these operations.

EDIT: Of course, as we do not attach to the SwiftUI view hierarchy, this doesn't set up an AppDelegate and therefore a LifecycleHandler will never be called.

from spezi.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.