This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// MARK: SortDescriptor | |
/// Type-erased Sort Descriptor (can store multiple in the same array | |
/// regardless of the underlying KeyPath | |
public struct SortDescriptor<Element> { | |
private let comparator: (Any, Any) -> Bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct SortDescriptor<Element> { | |
private let keyPath: PartialKeyPath<Element> | |
private let comparator: (Any, Any) -> ComparisonResult | |
// For abitrary `Value` types, the consumer has to provide the entire Comparator | |
public init<Value>( | |
_ keyPath: KeyPath<Element, Value>, | |
using comparator: @escaping (Value, Value) -> ComparisonResult) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run any SwiftUI view as a Mac app. | |
import Cocoa | |
import SwiftUI | |
NSApplication.shared.run { | |
VStack { | |
Text("Hello, World") | |
.padding() | |
.background(Capsule().fill(Color.blue)) |