Best way to modify on Cannot use mutating member on immutable value: self is immutable

You should be able to add mutating to the getter of the currentP property.

   public var currentP: String? {
+    mutating get {
       let currentTime = Date()
       return try? generator.p(at: currentTime)
+    }
   }
2 Likes