diff --git a/CHANGELOG.md b/CHANGELOG.md index b6f143abd..a23b27f35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag - Removed unneeded diffing functions `IGListDiffExperiment(...)` and `IGListDiffPathsExperiment(...)`. [Maxime Ollivier](https://github.com/maxolls) (tbd) +- `ListSectionController.collectionContext` and `ListGenericSectionController.object` are now implicitly-unwrapped optionals in Swift. [Nate Stedman](https://github.com/natestedman) (tbd) + +- The argument of `IGListGenericSectionController`'s `-didUpdateToObject:` is now generic, not `id`. [Nate Stedman](https://github.com/natestedman) (tbd) + ### Enhancements - Introduce `IGListSwiftKit`, with Swift refinements for `dequeueReusableCellOfClass` methods. [Koen Punt](https://github.com/koenpunt) [(#1388)](https://github.com/Instagram/IGListKit/pull/1388). diff --git a/Source/IGListKit/IGListGenericSectionController.h b/Source/IGListKit/IGListGenericSectionController.h index e0cf25e13..25f84e3b7 100644 --- a/Source/IGListKit/IGListGenericSectionController.h +++ b/Source/IGListKit/IGListGenericSectionController.h @@ -22,9 +22,10 @@ NS_SWIFT_NAME(ListGenericSectionController) returned. @note This object is briefly `nil` between initialization and the first call to `didUpdateToObject:`. After that, it is - safe to assume that this is non-`nil`. + safe to assume that this is non-`nil`. For this reason, we bridge it to Swift as an implicitly-unwrapped Optional, so + that idiomatic IGListKit code is not forced to handle nullability with explicit `as!` or `fatalError`. */ -@property (nonatomic, strong, nullable, readonly) ObjectType object; +@property (nonatomic, strong, null_unspecified, readonly) ObjectType object; /** Updates the section controller to a new object. diff --git a/Source/IGListKit/IGListSectionController.h b/Source/IGListKit/IGListSectionController.h index 68a455f4b..446346ad4 100644 --- a/Source/IGListKit/IGListSectionController.h +++ b/Source/IGListKit/IGListSectionController.h @@ -147,8 +147,13 @@ NS_SWIFT_NAME(ListSectionController) A context object for interacting with the collection. Use this property for accessing the collection size, dequeuing cells, reloading, inserting, deleting, etc. + + @note When created outside of `-listAdapter:sectionControllerForObject:`, this object is temporarily `nil` + after initialization. We bridge it to Swift as an implicitly-unwrapped Optional, so that idiomatic IGListKit + code is not forced to handle nullability with explicit `as!` or `fatalError`, as using a non-`nil` instance + of this object is essential for dequeueing cells. */ -@property (nonatomic, weak, nullable, readonly) id collectionContext; +@property (nonatomic, weak, null_unspecified, readonly) id collectionContext; /** Returns the section within the list for this section controller.