diff --git a/Passepartout/App/iOS/Global/SwiftGen+Assets.swift b/Passepartout/App/iOS/Global/SwiftGen+Assets.swift index 40b213ac..91737add 100644 --- a/Passepartout/App/iOS/Global/SwiftGen+Assets.swift +++ b/Passepartout/App/iOS/Global/SwiftGen+Assets.swift @@ -286,9 +286,11 @@ internal enum Asset { internal static let hideme = ImageAsset(name: "hideme") internal static let mullvad = ImageAsset(name: "mullvad") internal static let nordvpn = ImageAsset(name: "nordvpn") + internal static let oeck = ImageAsset(name: "oeck") internal static let pia = ImageAsset(name: "pia") internal static let placeholder = ImageAsset(name: "placeholder") internal static let protonvpn = ImageAsset(name: "protonvpn") + internal static let surfshark = ImageAsset(name: "surfshark") internal static let torguard = ImageAsset(name: "torguard") internal static let tunnelbear = ImageAsset(name: "tunnelbear") internal static let vyprvpn = ImageAsset(name: "vyprvpn") @@ -313,7 +315,8 @@ internal struct ImageAsset { #if os(iOS) || os(tvOS) let image = Image(named: name, in: bundle, compatibleWith: nil) #elseif os(macOS) - let image = bundle.image(forResource: NSImage.Name(name)) + let name = NSImage.Name(self.name) + let image = (bundle == .main) ? NSImage(named: name) : bundle.image(forResource: name) #elseif os(watchOS) let image = Image(named: name) #endif @@ -342,7 +345,11 @@ internal extension ImageAsset.Image { // swiftlint:disable convenience_type private final class BundleToken { static let bundle: Bundle = { - Bundle(for: BundleToken.self) + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: BundleToken.self) + #endif }() } // swiftlint:enable convenience_type diff --git a/Passepartout/App/iOS/Global/SwiftGen+Scenes.swift b/Passepartout/App/iOS/Global/SwiftGen+Scenes.swift index 86553a15..1c53260d 100644 --- a/Passepartout/App/iOS/Global/SwiftGen+Scenes.swift +++ b/Passepartout/App/iOS/Global/SwiftGen+Scenes.swift @@ -6,7 +6,7 @@ import Foundation import UIKit // swiftlint:disable superfluous_disable_command -// swiftlint:disable file_length +// swiftlint:disable file_length implicit_return // MARK: - Storyboard Scenes @@ -80,6 +80,11 @@ internal struct SceneType { } return controller } + + @available(iOS 13.0, tvOS 13.0, *) + internal func instantiate(creator block: @escaping (NSCoder) -> T?) -> T { + return storyboard.storyboard.instantiateViewController(identifier: identifier, creator: block) + } } internal struct InitialSceneType { @@ -91,12 +96,24 @@ internal struct InitialSceneType { } return controller } + + @available(iOS 13.0, tvOS 13.0, *) + internal func instantiate(creator block: @escaping (NSCoder) -> T?) -> T { + guard let controller = storyboard.storyboard.instantiateInitialViewController(creator: block) else { + fatalError("Storyboard \(storyboard.storyboardName) does not have an initial scene.") + } + return controller + } } // swiftlint:disable convenience_type private final class BundleToken { static let bundle: Bundle = { - Bundle(for: BundleToken.self) + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: BundleToken.self) + #endif }() } // swiftlint:enable convenience_type diff --git a/Passepartout/App/iOS/Global/SwiftGen+Segues.swift b/Passepartout/App/iOS/Global/SwiftGen+Segues.swift index 44b91b58..1b1897ab 100644 --- a/Passepartout/App/iOS/Global/SwiftGen+Segues.swift +++ b/Passepartout/App/iOS/Global/SwiftGen+Segues.swift @@ -56,11 +56,3 @@ internal extension SegueType where RawValue == String { self.init(rawValue: identifier) } } - -// swiftlint:disable convenience_type -private final class BundleToken { - static let bundle: Bundle = { - Bundle(for: BundleToken.self) - }() -} -// swiftlint:enable convenience_type diff --git a/Passepartout/App/iOS/Global/SwiftGen+Strings.swift b/Passepartout/App/iOS/Global/SwiftGen+Strings.swift index 1e72a659..d7713229 100644 --- a/Passepartout/App/iOS/Global/SwiftGen+Strings.swift +++ b/Passepartout/App/iOS/Global/SwiftGen+Strings.swift @@ -8,7 +8,7 @@ import Foundation // MARK: - Strings // swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length -// swiftlint:disable nesting type_body_length type_name +// swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces internal enum L10n { internal enum App { internal enum Account { @@ -254,10 +254,6 @@ internal enum L10n { internal enum Guidance { internal enum Footer { internal enum Infrastructure { - /// Use your %@ website credentials. - internal static func hideme(_ p1: Any) -> String { - return L10n.tr("Core", "account.sections.guidance.footer.infrastructure.hideme", String(describing: p1)) - } /// Use your %@ website credentials. Your username is usually numeric (without spaces). internal static func mullvad(_ p1: Any) -> String { return L10n.tr("Core", "account.sections.guidance.footer.infrastructure.mullvad", String(describing: p1)) @@ -274,10 +270,6 @@ internal enum L10n { internal static func protonvpn(_ p1: Any) -> String { return L10n.tr("Core", "account.sections.guidance.footer.infrastructure.protonvpn", String(describing: p1)) } - /// Use your %@ service credentials, which may differ from website credentials. - internal static func torguard(_ p1: Any) -> String { - return L10n.tr("Core", "account.sections.guidance.footer.infrastructure.torguard", String(describing: p1)) - } /// Use your %@ website credentials. Your username is usually your e-mail. internal static func tunnelbear(_ p1: Any) -> String { return L10n.tr("Core", "account.sections.guidance.footer.infrastructure.tunnelbear", String(describing: p1)) @@ -290,6 +282,16 @@ internal enum L10n { internal static func windscribe(_ p1: Any) -> String { return L10n.tr("Core", "account.sections.guidance.footer.infrastructure.windscribe", String(describing: p1)) } + internal enum Default { + /// Use your %@ service credentials, which may differ from website credentials. + internal static func specific(_ p1: Any) -> String { + return L10n.tr("Core", "account.sections.guidance.footer.infrastructure.default.specific", String(describing: p1)) + } + /// Use your %@ website credentials. + internal static func web(_ p1: Any) -> String { + return L10n.tr("Core", "account.sections.guidance.footer.infrastructure.default.web", String(describing: p1)) + } + } } } } @@ -1102,7 +1104,7 @@ internal enum L10n { } } // swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length -// swiftlint:enable nesting type_body_length type_name +// swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces // MARK: - Implementation Details @@ -1116,7 +1118,11 @@ extension L10n { // swiftlint:disable convenience_type private final class BundleToken { static let bundle: Bundle = { - Bundle(for: BundleToken.self) + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: BundleToken.self) + #endif }() } // swiftlint:enable convenience_type diff --git a/Passepartout/App/macOS/Global/SwiftGen+Assets.swift b/Passepartout/App/macOS/Global/SwiftGen+Assets.swift index 72f83eba..531a074a 100644 --- a/Passepartout/App/macOS/Global/SwiftGen+Assets.swift +++ b/Passepartout/App/macOS/Global/SwiftGen+Assets.swift @@ -286,6 +286,7 @@ internal enum Asset { internal static let hideme = ImageAsset(name: "hideme") internal static let mullvad = ImageAsset(name: "mullvad") internal static let nordvpn = ImageAsset(name: "nordvpn") + internal static let oeck = ImageAsset(name: "oeck") internal static let pia = ImageAsset(name: "pia") internal static let placeholder = ImageAsset(name: "placeholder") internal static let protonvpn = ImageAsset(name: "protonvpn")