다른 class에서 struct값 가져올때..

2016. 8. 4. 07:59Programming/Swift

반응형


* Send

class SendClass {


    struct sendStruct {
        var name: String
        var age: String
    }

    var sendArray = [sendStruct]()

    func SendFunction() -> Array<sendStruct> {

        return sendArray

    }
}

* Receive

class RecevieClass {

    struct ReceiveStruct {
        var name: String
        var age: String
    }

    var ReceiveArray: Array<ReceiveStruct> = [ReceiveStruct]()

    let Send = SendClass()

    ReceiveArray =  Send.SendFunction().map {

        ReceiveStruct(name: $0.name, age: $0.age)

    }

}


반응형