VAAA VAAA - 1 year ago 85
Swift Question

Swift - How to create an array of string from an object array

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
property. That way I will have a string array that will contain only
property values.

Any clue

Answer Source

let descriptions = { $0.description }

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download