Skip to content

Releases: AliSoftware/Dip

Swift 3

11 Sep 20:11
Compare
Choose a tag to compare

New

  • Migrated to Swift 3.0
    #120, @patrick-lind, @mark-urbanthings, @ilyapuchka
  • Renamed DefinitionOf to Definition and some other source-breaking refactoring.
    #113, @ilyapuchka
  • Added invalidType error when resolved instance does not implement requested type.
    #118, @ilyapuchka
  • Added optional type parameter in register methods to be able to specify type when registering using method literal instead of closure.
    #115, @ilyapuchka
  • Added implements family of methods in to Definition to register type-forwarding definitions.
    #114, @ilyapuchka
  • Shared scope is now the default scope.
    #112, @ilyapuchka
  • Single target project setup.
    #121, @ilyapuchka
  • Simplified implementation of auto-wiring. Container now chooses the definition for type with most number of arguments and does not use other definitions if this one fails to resolve.
    #117, @ilyapuchka

Fixed

  • Auto-injected properties inherited from super class are now properly injected when resolving subclass.
    Added resolveDependencies(_:DependencyContainer) method to Resolvable protocol to handle inheritance when resolving.
    #116, @ilyapuchka

4.6.1

14 Aug 21:25
Compare
Choose a tag to compare

New

Fixed

  • Fixed sharing singletons between collaborating containers
    #103, @ilyapuchka

Notes on API changes

All changes are made by adding new API and deprecating old versions. They will be removed in the next release.

  1. ObjectGraph scope is renamed to Shared, Prototype scope is renamed to Unique.
  2. resolveDependencies method of DefinitionOf<T> is renamed to resolvingProperties
  3. DefinitionKey properties protocolType is renamed to type, associatedTag is renamed to tag, argumentsType is renamed to typeOfArguments.
  4. resolve method parameter withArguments is renamed to arguments. That change affects all resolve methods of DependencyContainer
  5. Order of scope and tag parameters in register method is switched. That change affects all register methods of DependencyContainer

Containers collaboration & weak singletons

17 Jul 20:16
Compare
Choose a tag to compare

New features

  • Containers collaboration. Break your definitions in modules and link them together.
    #95, @ilyapuchka
  • Added WeakSingleton scope.
    #96, @ilyapuchka
  • Properties auto-injection now is performed before calling resolveDependencies block
    #97, @ilyapuchka
  • Fixed updating container's context when resolving properties with auto-injection.
    #98, @ilyapuchka
  • Improved logging.
    #94, #99, @ilyapuchka
  • Fixed warning about using only extensions api.
    #92, @mwoollard

Type forwarding, weak types & optionals

08 Jun 21:48
Compare
Choose a tag to compare

New features

  • Added weakly-typed API to resolve components when exact type is unknown during compile time.
    #79, @ilyapuchka
  • Added type forwarding feature. You can register the same factory to resolve different types.
    #89, @ilyapuchka
  • Container now can resolve optional types 🎉
    #84, @ilyapuchka
  • Added container context that provides contextual information during graph resolution process.
    #83, @ilyapuchka
  • Added method to validate container configuration.
    #87, @ilyapuchka
  • Added method to manually set value wrapped by auto-injection wrappers.
    #81, @ilyapuchka
  • Added separate error type for failures during auto-wiring.
    #85, @ilyapuchka

Note

With introduction of type-forwarding the behavior of func resolveDependencies(block: (DependencyContainer, T) throws -> ()) -> DefinitionOf<T, F> changed. Now you can call this method several times on the same definition. When instance is resolved using this definition the container will call all the blocks that you passed to this method in the same order as you called this method.

Eager Singletons

31 Mar 21:08
Compare
Choose a tag to compare

New features

  • Added .EagerSingleton scope for objectes requiring early instantiation and bootstrap() method on DepenencyContainer. Call bootstrap to fix container setup and instantiate all eager singletons.
    #65, @ilyapuchka

Bug fixes

  • Reverted order of Resolvable callbacks. Now last resolved Resolvable instance will receive didResolveDependencies callback first.
    #67, @ilyapuchka

Swift 2.2

24 Mar 11:28
Compare
Choose a tag to compare

Fixed

Auto-wiring, Resolvable & DependencyTagConvertible

19 Mar 16:55
Compare
Choose a tag to compare

New features

  • Added DependencyTagConvertible protocol for better typed tags.
    #50, @gavrix
  • Auto-wiring. DependencyContainer resolves constructor arguments automatically.
    #55, @ilyapuchka
  • Added Resolvable protocol to get a callback when dependencies graph is complete.
    #57, @ilyapuchka
  • Removed DipError.ResolutionFailed error for better consistency.
    #58, @ilyapuchka

SMP & Linux

19 Mar 15:58
Compare
Choose a tag to compare

New features

Bug fixes

  • Fixed the issue that could cause singleton instances to be reused between different containers.
    #43, @ilyapuchka

Auto-Injection, Errors handling & Thread-Safety

04 Feb 20:08
Compare
Choose a tag to compare

New features

  • Added auto-injection feature.
    #13, @ilyapuchka
  • Factories and resolveDependencies blocks of DefinitionOf are now allowed to throw. Improved errors handling.
    #32, @ilyapuchka
  • Thread safety reimplemented with support for recursive methods calls.
    #31, @mwoollard

Circular Dependencies & throw

12 Dec 21:36
Compare
Choose a tag to compare

New Features

  • Added support for circular dependencies:
    • Added ObjectGraph scope to reuse resolved instances
    • Added resolveDependencies method on DefinitionOf class to resolve dependencies of resolved instance.
      #11, @ilyapuchka
  • Added methods to register/remove individual definitions.
    #11, @ilyapuchka
  • All resolve methods now can throw error if type can not be resolved.
    #15, @ilyapuchka
  • DependencyContainer is marked as final.
  • Added support for OSX, tvOS and watchOS2.
    #26, @ilyapuchka

Breaking Changes

  • Removed container thread-safety to enable recursion calls to resolve.
    Access to container from multiple threads should be handled by clients from now on.

  • All resolve methods now can throw.

    Note on migration from 3.x to 4.0.0:

    • Errors

    In 4.0.0 each resolve method can throw DefinitionNotFound(DefinitionKey) error, so you need to call it using try! or try?, or catch the error if it's appropriate for your case. See #15 for rationale of this change.

    • Thread safety

    In 4.0.0 DependencyContainer drops any guarantee of thread safety. From now on code that uses Dip must ensure that it's methods are called from a single thread. For example if you have registered type as a singleton and later two threads try to resolve it at the same time you can have two different instances of type instead of one as expected. This change was required to enable recursive calls of resolve method to resolve circular dependencies.

    • Removed methods

    Methods deprecated in 3.1.0 are now removed.