Skip to content

Commit 981a2e6

Browse files
committed
feat: apply codable URLString to URL property of world models
1 parent 80221c3 commit 981a2e6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Sources/VRCKit/Models/URLString.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
import Foundation
99

1010
public struct URLString: Codable, Hashable {
11-
let url: URL
11+
public let url: URL
12+
13+
public init(url: URL) {
14+
self.url = url
15+
}
1216

1317
public init(from decoder: any Decoder) throws {
1418
let container = try decoder.singleValueContainer()

Sources/VRCKit/Models/WorldModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public struct World: Codable, Identifiable, Hashable {
1717
public let capacity: Int
1818
public let tags: [String]
1919
public let releaseStatus: ReleaseStatus
20-
public let imageUrl: String
21-
public let thumbnailImageUrl: String
20+
public let imageUrl: URLString
21+
public let thumbnailImageUrl: URLString
2222
public let namespace: String?
2323
public let organization: String
2424
public let previewYoutubeId: String?

Sources/VRCKit/PreviewServices/PreviewDataProvider.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ final class PreviewDataProvider {
206206
capacity: 32,
207207
tags: [],
208208
releaseStatus: .public,
209-
imageUrl: "https://ul.h3z.jp/ecWPM0Wk.jpg",
210-
thumbnailImageUrl: "https://ul.h3z.jp/ecWPM0Wk.jpg",
209+
imageUrl: URLString(url: URL(string: "https://ul.h3z.jp/ecWPM0Wk.jpg")!),
210+
thumbnailImageUrl: URLString(url: URL(string: "https://ul.h3z.jp/ecWPM0Wk.jpg")!),
211211
namespace: nil,
212212
organization: "",
213213
previewYoutubeId: "",

0 commit comments

Comments
 (0)