|
I recently starteded working on an app for creating characters in a ttrpg. In the initial view the idea is that a characters abilities are all rolled together. After they have been rolled, they may reroll individual abilities if the scores are too low. Here is an ability:
The problem I am having is in the card subview I created, I am getting the error: "Cannot use mutating member on immutable value: 'self' is immutable". I've tried chaning Here is the card:
What am I missing here? Aren't classes supposed to be mutable? |
|
Sorry about that... protocol is:
|
|
Lol, yeah, by rolling abilities together... it is meant to simulate rolling dice to generate character stats for a role-playing game. |
|
I mucked around and got a card view to work. But removed the Ability protocol, which probably is useful for your other cards. Wasn't sure about using UInt? Is there a lesson here for us? Why UInt over a vanilla Int? Also implemented Also implemented the array of modifiers to be a computed property based on
|
|
I went with |
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.