Skip to content

Commit

Permalink
feat: apply codable URLString to URL property of world models
Browse files Browse the repository at this point in the history
  • Loading branch information
makinosp committed Jul 28, 2024
1 parent 80221c3 commit 981a2e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Sources/VRCKit/Models/URLString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
import Foundation

public struct URLString: Codable, Hashable {
let url: URL
public let url: URL

public init(url: URL) {
self.url = url
}

public init(from decoder: any Decoder) throws {
let container = try decoder.singleValueContainer()
Expand Down
4 changes: 2 additions & 2 deletions Sources/VRCKit/Models/WorldModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public struct World: Codable, Identifiable, Hashable {
public let capacity: Int
public let tags: [String]
public let releaseStatus: ReleaseStatus
public let imageUrl: String
public let thumbnailImageUrl: String
public let imageUrl: URLString
public let thumbnailImageUrl: URLString
public let namespace: String?
public let organization: String
public let previewYoutubeId: String?
Expand Down
4 changes: 2 additions & 2 deletions Sources/VRCKit/PreviewServices/PreviewDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ final class PreviewDataProvider {
capacity: 32,
tags: [],
releaseStatus: .public,
imageUrl: "https://ul.h3z.jp/ecWPM0Wk.jpg",
thumbnailImageUrl: "https://ul.h3z.jp/ecWPM0Wk.jpg",
imageUrl: URLString(url: URL(string: "https://ul.h3z.jp/ecWPM0Wk.jpg")!),
thumbnailImageUrl: URLString(url: URL(string: "https://ul.h3z.jp/ecWPM0Wk.jpg")!),
namespace: nil,
organization: "",
previewYoutubeId: "",
Expand Down

0 comments on commit 981a2e6

Please sign in to comment.