How to return two values?

前端 未结 4 2131
深忆病人
深忆病人 2021-02-13 10:05

I\'d like to return a Cartesian coordinate (x, y), as two ints. The only way I see is to create a class and return an instance of it.

How to return two value

4条回答
  •  心在旅途
    2021-02-13 10:21

    I recommend you to return an NSDictionary, inside Dictionary you can store and send any object type and any number of variables.

    -(NSDictionary*)calculateWith:(id)arg
    {
    NSDictionary *urDictionary =@{@"key1":value1,@"Key2":value2,.....};
    return  urDictionary;
    }
    

提交回复
热议问题