mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
* We can't just remove PAYWALL_COMPONENT because we don't support macos and tv and things were failing * Move PartialComponent outside of PaywallComponent extension * Fix some lint errors * Wrong thing * Undid things i shouldn't have done * Removed more * Added comment * Removed/fix some places for the check thingies * RevenueCat module compiles on all the things * RevenueCatUI compiles in all the platforms now * Make all the things compile again * Make work for visionOS * Fix some platform and xcode version issues * Fix failing spm ios 15 test * Undo circleci changes * Replace smooth with easeInOut * Only run the thing i want * Attempt to remove circular * Explicit returns * Does this pass * This is it * Swift 5.9 for this * All tests again * Undid public testing processor stuff * Undo this too * Swift compiler check out pill style circular * Fixes from PR review * Fix compile for mac
45 lines
1.2 KiB
Swift
45 lines
1.2 KiB
Swift
//
|
|
// Copyright RevenueCat Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the MIT License (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://opensource.org/licenses/MIT
|
|
//
|
|
// PaywallComponentLocalization.swift
|
|
//
|
|
// Created by James Borthwick on 2024-09-03.
|
|
// swiftlint:disable missing_docs
|
|
|
|
import Foundation
|
|
|
|
extension PaywallComponent.LocalizationDictionary {
|
|
|
|
public func string(key: String) throws -> String {
|
|
guard case let .string(value) = self[key] else {
|
|
throw LocalizationValidationError.missingLocalization(
|
|
"Missing string localization for property with id: \"\(key)\""
|
|
)
|
|
}
|
|
return value
|
|
}
|
|
|
|
public func image(key: String) throws -> PaywallComponent.ThemeImageUrls {
|
|
guard case let .image(value) = self[key] else {
|
|
throw LocalizationValidationError.missingLocalization(
|
|
"Missing image localization for property with id: \"\(key)\""
|
|
)
|
|
}
|
|
return value
|
|
}
|
|
|
|
}
|
|
|
|
enum LocalizationValidationError: Error {
|
|
|
|
case missingLocalization(String)
|
|
case invalidUrl(String)
|
|
|
|
}
|