-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attribute をAPI 使用者が追加できるようにする #34
Comments
protocol CustomElement {
associatedtype T
var value: T { get }
var keyPath: WritableKeyPath<AttributeContext, T> { get }
} |
Open
protocol AttributeLinkList {
associatedtype T: CustomElement
} |
構造体に KeyPath をプロパティに持たせようと以下のようなコードにしました。 struct AttributeContext {
var container = AttributeContainer()
}
struct BackgroundColor: CustomElement {
let value: Color
var keyPath: WritableKeyPath<AttributeContext, Color> {
\.container.backgroundColor
}
} しかし、KeyPath が static subscript を指し示すことはできないようでした。 |
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
再帰型構造体を使用し、SKNodeBuilder の Modifier と同じように実装することで Attribute を自作できるようになります。
The text was updated successfully, but these errors were encountered: