阅读背景:

Swift:捕获逃脱被调用函数的闭包中的inout参数

来源:互联网 

I tried to write an "editor" class that could retain a reference to a property on a different object for later mutation. I first wrote the editor class to receive a closure for reading, and a closure for writing. This worked. I then tried to pass the parameter in question by (inout) reference, and then generate the getter / setter pair from that. This did not work. The Swift docs does say (paraphrasing) that Swift figures out when to copy, and when to not. I think I am up against unpredictability of that limitation, but thought I'd pose the question just the same. I tried to write an "editor" class that could r




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: