On 25 Jul 2016, at 15:10, 褚 晓敏 via swift-users <[email protected]> wrote:

> So what should it be, according to API design guidelines?

It’s hard to answer this question without more information about your specific 
context.  However, I think it’s safe to say that Swift expresses a preference 
for value types.  OTOH, reference types exist for a reason: sometimes you 
really do want to model shared mutable state.

My approach to this is to design the data structure as a value type and see how 
that works out for clients.  If the client code looks good, you’re set.  OTOH, 
if the client code is painful, you need to rethink.

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to