Cocoa NSArray/NSSet: -makeObjectsPerformSelector: vs. fast enumeration

后端 未结 5 1036
臣服心动
臣服心动 2021-02-13 09:50

I want to perform the same action over several objects stored in a NSSet.

My first attempt was using a fast enumeration:

for (id item in myS         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-13 10:14

    makeObjectsPerformSelector: might be slightly faster, but I doubt there's going to be any practical difference 99% of the time. It is a bit more concise and readable though, I would use it for that reason.

提交回复
热议问题