I have the following class:
class ServicePaymentRate : AnyObject {
var servicePaymentRateUid : String = ""
var servicePaymentCode : String = ""
var description : String = ""
var paymentPercentage : Float = 0
var isPrimary : Bool = false
var isFacility : Bool = false
}
Then the class is popullated in order to get an array of that class:
var rates : Array<ServicePaymentRate>
What I need now is to create a String array from the above object array by filtering description
property. That way I will have a string array that will contain only description
property values.
Any clue
答案 0 :(得分:4)
let descriptions = rates.map { $0.description }