Decompose `IdentifiableComponent` to `Identifiable` and `Component`
ra1028 opened this issue · comments
Ryo Aoyama commented
Checklist
- Reviewed the README and documents.
- Searched existing issues for ensure not duplicated.
Description
Decompose IdentifiableComponent
to Identifiable
and Component
.
Motivation and Context
Use protocol composition like SwiftUI.
Proposed Solution
Use Swift.Identifiable
if Swift version is greater than 5, and creates Carbon.Identifiable
protocol if not.
e.g.
#if swift(<5)
public protocol Identifiable {
associatedtype ID: Hashable
var id: ID { get }
}
#endif
typealias IdentifiableComponent = Identifiable & Component
IdentifiableComponent
will be deprecated in the future, but not now.
Ryo Aoyama commented
Swift.Identifiable
depends on iOS 13 due to ABI stability. This means that can't decides whether to use Identifiable
typealias at compile time.
Close this issue to avoid ambiguous type declaration in Swift.Identifiable
and Carbon.Identifiable
.