Post

Replies

Boosts

Views

Activity

Reply to Calling a property of a struct with a placeholder?
Claude, I used your "else" suggestion and cleaned it up a bit Ooper, I used the same code and I think I can make it work for currentBoost. I left out the skill struct by accident, but it works when I typed it out like this var currentTraining: WritableKeyPath<Horse, Float> = \.basicTraining //or \.rhythm or \.suppleness var currentBoost: WritableKeyPath<Skill, Float> = \.basicBoost This might clean up a lot of unnecessary code, but how can I change the \.basicTraining to \.rhythm in the variable? I tried this with no luck currentTraining = \.rhythm print(currentTraining) The console reads "Swift.WritableKeyPath<Tobiano.Horse, Swift.Float>"
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’21