Is it a good idea to have NSSortDescriptor declared static in a Utility class? I do some sorting of arrays in my application in perhaps 10 different places. I’m thinking if I can reuse the NSSortDescriptor from my Utility class it would use less memory when allocating a new NSSortDescriptor whenever I want to sort something?
Is it a good idea to have NSSortDescriptor declared static in a Utility class?
Share
Why not? ObjC classes are lightweight anyhow, and NSSortDescriptor is just an object, and your memory logic is spot on, so long as this isn’t just a one time thing.