Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct MyObject {
- let someBool: Bool
- }
- var MyObjects = [
- MyObject(someBool: true),
- MyObject(someBool: true),
- MyObject(someBool: false),
- MyObject(someBool: true),
- MyObject(someBool: false),
- MyObject(someBool: false),
- MyObject(someBool: true),
- ]
- let resorted = MyObjects.sorted { $0.someBool && !$1.someBool }
- /**
- true
- true
- true
- false
- false
- false
- */
- _ = resorted.map { print($0.someBool )}
Add Comment
Please, Sign In to add comment