Skip to content

Commit 25f4f13

Browse files
committed
fix: swift
1 parent f02eeca commit 25f4f13

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

templates/swift/guides/search/saveObjectsMCM.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ let getAllAppIDConfigurations: () -> [(String, String)] = {
1010
return [/* A list of your MCM AppID/ApiKey pairs */]
1111
}
1212

13-
let playlists: [[String: AnyCodable]] = [/* Your records */]
14-
1513
func saveObjectsMCM() async throws {
14+
let playlists: [[String: AnyCodable]] = [ /* Your records */ ]
15+
1616
// Fetch from your own data storage and with your own code
1717
// the list of application IDs and API keys to target each cluster
1818
let configurations = getAllAppIDConfigurations();

templates/swift/guides/search/saveObjectsPublicUser.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import Foundation
66
import Core
77
{{> snippets/import}}
88

9-
let playlists: [[String: AnyCodable]] = [] // Your records
10-
119
func saveObjectsPublicUser() async throws {
10+
let playlists: [[String: AnyCodable]] = [] // Your records
11+
1212
do {
1313
{{> snippets/init}}
1414

templates/swift/guides/search/savePopularRecords.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@ import Foundation
66
import Core
77
{{> snippets/import}}
88

9+
struct Record: Codable {
10+
let twitterHandle: String
11+
let nbFollowers: Int
12+
var isPopular: Bool = false
13+
}
14+
915
func savePopularRecords() async throws {
1016
do {
1117
{{> snippets/init}}
1218

1319
var records: [Record] = []
1420

15-
try await client.browseObjects(indexName: indexName, browseParams: BrowseParamsObject(), aggregator: { (response: BrowseResponse<Record>) in
21+
try await client.browseObjects(indexName: "YOUR_INDEX_NAME", browseParams: BrowseParamsObject(), aggregator: { (response: BrowseResponse<Record>) in
1622
records.append(contentsOf: response.hits.map {
1723
$0.nbFollowers < 1_000_000 ? $0 : Record(
1824
twitterHandle: $0.twitterHandle,

templates/swift/guides/search/setHeaderUserIDThenSaveObjects.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import Foundation
66
import Core
77
{{> snippets/import}}
88

9-
let playlists: [[String: AnyCodable]] = [/* Your records */]
10-
119
func setHeaderUserIDThenSaveObjects() async throws {
10+
let playlists: [[String: AnyCodable]] = [/* Your records */]
11+
1212
do {
1313
{{> snippets/init}}
1414

0 commit comments

Comments
 (0)