Open DianQK opened 5 years ago
Maybe you will find Segmentation fault: 11 While emitting IR SIL function ... error info when use AnimatableCollectionViewProvider. This look like Swift bug.
AnimatableCollectionViewProvider
This issue will closed when this error go away.
This code will cause Segmentation fault: 11:
class TestRadioProvider<Option: Equatable & StringIdentifiableType>: AnimatableCollectionViewProvider { func configureCell(_ collectionView: UICollectionView, cell: RadioCollectionViewCell, indexPath: IndexPath, value: Value) { } func createValues() -> Observable<[Value]> { return Observable.empty() } typealias Cell = RadioCollectionViewCell typealias Value = Option }
There are some workaround methods:
add createAnimatableNodes:
createAnimatableNodes
class TestRadioProvider<Option: Equatable & StringIdentifiableType>: AnimatableCollectionViewProvider { func configureCell(_ collectionView: UICollectionView, cell: RadioCollectionViewCell, indexPath: IndexPath, value: Value) { } func createValues() -> Observable<[Value]> { return Observable.empty() } typealias Cell = RadioCollectionViewCell typealias Value = Option func createAnimatableNodes() -> Observable<[IdentifiableNode]> { let providerIdentity = self._flix_identity return createValues() .map { $0.map { IdentifiableNode(providerIdentity: providerIdentity, valueNode: $0) } } } }
or add a model to warp this Option:
Option
struct SegmentationFault11Warp<Value: Equatable & StringIdentifiableType>: Equatable & StringIdentifiableType { var identity: String { return value.identity } let value: Value } class TestRadioProvider<Option: Equatable & StringIdentifiableType>: AnimatableCollectionViewProvider { func configureCell(_ collectionView: UICollectionView, cell: RadioCollectionViewCell, indexPath: IndexPath, value: Value) { } func createValues() -> Observable<[Value]> { return Observable.empty() } typealias Cell = RadioCollectionViewCell typealias Value = SegmentationFault11Warp<Option> }
This very helpful !
@DianQK wondering how to explain the crash and your advised ways of workaround ?
Maybe you will find Segmentation fault: 11 While emitting IR SIL function ... error info when use
AnimatableCollectionViewProvider
. This look like Swift bug.This issue will closed when this error go away.
This code will cause Segmentation fault: 11:
There are some workaround methods:
add
createAnimatableNodes
:or add a model to warp this
Option
: