Swift Lazy Containers Versions Save

A few lazy-initialization container types for Swift 5.1

4.1.0

1 year ago

Now, lazy containers automatically gain conformance to these protocols when their Value also conforms to them:

  • Equatable
  • Hashable
  • Encodable
  • Decodable

This means that every @Lazy, @ResettableLazy, and @FunctionalLazy field is automatically and transparently made to conform to these just like if they were not lazy!

Important: In order to do this, of course, the value will have to be evaluated. That is, if your @Lazy Hashable field is not yet initialized when you want to get its hash value, then it's automatically initialized first.

4.0.0

3 years ago

Thanks to Gabe Shahbazian for reporting this bug. This seems to have been a symptom of a lower-level bug in Swift <5.3, where it would not properly wrap @autoclosure arguments for property wrappers. Sadly, the only "fix" I could find was to prevent the @Lazy property wrapper from being used in Swift <5.3. If you need to use Swift 5.2 or earlier, you can still use the old style:

// In Swift 5.2.x and earlier
let expensive = Lazy<Expensive> { ExpenseFactory.next() }

// In Swift 5.3 and newer
@Lazy
var expensive = ExpenseFactory.next()

Because this causes anyone using @Lazy property wrappers in Swift <5.3 to see compiler errors where there were none previously, this is a Major version increment.

3.1.2

3 years ago
  • Split the license into two, one special for certain entities, and the other for everyone else
  • Upgraded the license for everyone else from BH-0-PD to BH-1-PS. This means that, if this license applies to you, then you must provide attribution when using this package, among other requirements and restrictions.

Patch Changes

  • 3.1.2
    • Added alternative dynamic library product
  • 3.1.1
    • Updated header comment in LazyContainers.swift

3.0.2

4 years ago

Thanks to Brandon Starcheus for fixing this with #15.


See the release notes for 3.0.1 for important changes since 2.x and 1.x.

3.0.1

4 years ago

Resolved some assumptions about Swift Package Manager and updated to yet another Swift 5.1 beta syntax.

Important changes since 2.x are listed in the readme: https://github.com/RougeWare/Swift-Lazy-Patterns/commit/84c7de0730ff0a4331bb47435a582293a2dac4e4#diff-04c6e90faac2675aa89e2176d2eec7d8 Important changes since 1.x are listed here: https://github.com/RougeWare/Swift-Lazy-Patterns/releases/tag/2.0.0

With the 3.0.0 release, this package will no longer be distributed as a binary. Please consume this as a Swift Package and compile it as a part of your build process.

2.0.0

4 years ago

New Features

  • Rebranded to Lazy Containers, since this repo focuses on providing containers that lazily hold values, but doesn't focus providing patterns for how to do this (although, it does provide the tools to do that).
  • You can now use Lazy, ResettableLazy, and FunctionalLazy as property wrappers!
  • FunctionalLazy is now passed by value, rather than by reference.
  • You can still lazily initialize the value held within a Lazy, ResettableLazy, nor a FunctionalLazy in a non-mutating way, but you can no longer manually set it. This remains consistent with the goal of this repo (to provide a way to lazily initialize a value). In order to set a value-passed instance in a non-mutating way, see Swift-Safe-Pointer.
  • You can now create an instance of any lazy container with a value already initialized inside it. This is useful when you need a uniform API (for instance, when implementing a protocol that requires a Lazy), but require it to already hold a value up-front.
  • Added repo format which allows this to be a Swift Package.
  • Added unit tests to continue proving stability.

1.1.1

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago