```swift Amplify.DataStore.query(Post.self, sort: .by(.ascending(Post.keys.rating), .descending(Post.keys.title))) { switch $0 { case .success(let result): print("Posts: \(result)") case .failure(let error): print("Error listing posts - \(error.localizedDescription)") } } ``` ```swift let sink = Amplify.DataStore.query(Post.self, sort: .by(.ascending(Post.keys.rating), .descending(Post.keys.title))).sink { if case let .failure(error) = $0 { print("Error listing posts - \(error.localizedDescription)") } } receiveValue: { result in print("Posts: \(result)") } ```