diff --git a/.swiftlint.yml b/.swiftlint.yml index 2b667299..a2fa581a 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,5 +1,5 @@ # -# This source file is part of the Spezi open source project +# This source file is part of the Stanford Spezi open-source project # # SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md) # @@ -141,8 +141,6 @@ only_rules: - implicitly_unwrapped_optional # Identifiers should use inclusive language that avoids discrimination against groups of people based on race, gender, or socioeconomic status - inclusive_language - # If defer is at the end of its parent scope, it will be executed right where it is anyway. - - inert_defer # Prefer using Set.isDisjoint(with:) over Set.intersection(_:).isEmpty. - is_disjoint # Discouraged explicit usage of the default separator. @@ -329,8 +327,6 @@ only_rules: - unowned_variable_capture # Catch statements should not declare error variables without type casting. - untyped_error_in_catch - # Unused reference in a capture list should be removed. - - unused_capture_list # Unused parameter in a closure should be replaced with _. - unused_closure_parameter # Unused control flow label should be removed. @@ -371,16 +367,18 @@ only_rules: # The variable should be placed on the left, the constant on the right of a comparison operator. - yoda_condition +attributes: + attributes_with_arguments_always_on_line_above: false + deployment_target: # Availability checks or attributes shouldn’t be using older versions that are satisfied by the deployment target. iOSApplicationExtension_deployment_target: 16.0 iOS_deployment_target: 16.0 -attributes: - attributes_with_arguments_always_on_line_above: false - excluded: # paths to ignore during linting. Takes precedence over `included`. - .build - .swiftpm + - .derivedData + - Tests/UITests/.derivedData closure_body_length: # Closure bodies should not span too many lines. - 35 # warning - default: 20 diff --git a/Package.swift b/Package.swift index ef164380..4eaf5b93 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.7 +// swift-tools-version:5.8 // // This source file is part of the Spezi open source project @@ -22,7 +22,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/StanfordSpezi/Spezi", .upToNextMinor(from: "0.7.0")), - .package(url: "https://github.com/StanfordSpezi/SpeziViews", .upToNextMinor(from: "0.3.0")) + .package(url: "https://github.com/StanfordSpezi/SpeziViews", .upToNextMinor(from: "0.4.0")) ], targets: [ .target( diff --git a/Sources/SpeziAccount/Email and Password/EmailPasswordAccountService.swift b/Sources/SpeziAccount/Email and Password/EmailPasswordAccountService.swift index e72f2bfd..1186c29a 100644 --- a/Sources/SpeziAccount/Email and Password/EmailPasswordAccountService.swift +++ b/Sources/SpeziAccount/Email and Password/EmailPasswordAccountService.swift @@ -31,13 +31,13 @@ open class EmailPasswordAccountService: UsernamePasswordAccountService { } override open var localization: Localization { - let usernameField = FieldLocalization( - title: String(moduleLocalized: "EAP_LOGIN_USERNAME_TITLE"), - placeholder: String(moduleLocalized: "EAP_LOGIN_USERNAME_PLACEHOLDER") + let usernameField = FieldLocalizationResource( + title: LocalizedStringResource("EAP_LOGIN_USERNAME_TITLE", bundle: .atURL(from: .module)), + placeholder: LocalizedStringResource("EAP_LOGIN_USERNAME_PLACEHOLDER", bundle: .atURL(from: .module)) ) return Localization( - login: .init(buttonTitle: String(moduleLocalized: "EAP_LOGIN_BUTTON_TITLE"), username: usernameField), - signUp: .init(buttonTitle: String(moduleLocalized: "EAP_SIGNUP_BUTTON_TITLE"), username: usernameField), + login: .init(buttonTitle: LocalizedStringResource("EAP_LOGIN_BUTTON_TITLE", bundle: .atURL(from: .module)), username: usernameField), + signUp: .init(buttonTitle: LocalizedStringResource("EAP_SIGNUP_BUTTON_TITLE", bundle: .atURL(from: .module)), username: usernameField), resetPassword: .init(username: usernameField) ) } @@ -76,7 +76,7 @@ open class EmailPasswordAccountService: UsernamePasswordAccountService { } - override open func button(_ title: String, destination: V) -> AnyView { + override open func button(_ title: LocalizedStringResource, destination: V) -> AnyView { AnyView( NavigationLink { destination diff --git a/Sources/SpeziAccount/Username and Password/Localization/Localization+Login.swift b/Sources/SpeziAccount/Username and Password/Localization/Localization+Login.swift index cb893d9e..e9c2d607 100644 --- a/Sources/SpeziAccount/Username and Password/Localization/Localization+Login.swift +++ b/Sources/SpeziAccount/Username and Password/Localization/Localization+Login.swift @@ -6,6 +6,7 @@ // SPDX-License-Identifier: MIT // +import Foundation import SpeziViews @@ -28,58 +29,58 @@ extension Localization { public struct Login: Codable { /// A default configuration for providing localized text to login views. public static let `default` = Login( - buttonTitle: String(moduleLocalized: "UAP_LOGIN_BUTTON_TITLE"), - navigationTitle: String(moduleLocalized: "UAP_LOGIN_NAVIGATION_TITLE"), - username: FieldLocalization( - title: String(moduleLocalized: "UAP_LOGIN_USERNAME_TITLE"), - placeholder: String(moduleLocalized: "UAP_LOGIN_USERNAME_PLACEHOLDER") + buttonTitle: LocalizedStringResource("UAP_LOGIN_BUTTON_TITLE", bundle: .atURL(from: .module)), + navigationTitle: LocalizedStringResource("UAP_LOGIN_NAVIGATION_TITLE", bundle: .atURL(from: .module)), + username: FieldLocalizationResource( + title: LocalizedStringResource("UAP_LOGIN_USERNAME_TITLE", bundle: .atURL(from: .module)), + placeholder: LocalizedStringResource("UAP_LOGIN_USERNAME_PLACEHOLDER", bundle: .atURL(from: .module)) ), - password: FieldLocalization( - title: String(moduleLocalized: "UAP_LOGIN_PASSWORD_TITLE"), - placeholder: String(moduleLocalized: "UAP_LOGIN_PASSWORD_PLACEHOLDER") + password: FieldLocalizationResource( + title: LocalizedStringResource("UAP_LOGIN_PASSWORD_TITLE", bundle: .atURL(from: .module)), + placeholder: LocalizedStringResource("UAP_LOGIN_PASSWORD_PLACEHOLDER", bundle: .atURL(from: .module)) ), - loginActionButtonTitle: String(moduleLocalized: "UAP_LOGIN_ACTION_BUTTON_TITLE"), - defaultLoginFailedError: String(moduleLocalized: "UAP_LOGIN_FAILED_DEFAULT_ERROR") + loginActionButtonTitle: LocalizedStringResource("UAP_LOGIN_ACTION_BUTTON_TITLE", bundle: .atURL(from: .module)), + defaultLoginFailedError: LocalizedStringResource("UAP_LOGIN_FAILED_DEFAULT_ERROR", bundle: .atURL(from: .module)) ) - /// A localized `String` to display on the login button. - public let buttonTitle: String - /// A localized `String` for login view's navigation title. - public let navigationTitle: String + /// A localized `LocalizedStringResource` to display on the login button. + public let buttonTitle: LocalizedStringResource + /// A localized `LocalizedStringResource` for login view's navigation title. + public let navigationTitle: LocalizedStringResource /// A `FieldLocalization` instance containing the localized title and placeholder text for the username field. - public let username: FieldLocalization + public let username: FieldLocalizationResource /// A `FieldLocalization` instance containing the localized title and placeholder text for the password field. - public let password: FieldLocalization - /// A localized `String` to display on the login action button. - public let loginActionButtonTitle: String - /// A localized`String` error message to be displayed when login fails. - public let defaultLoginFailedError: String + public let password: FieldLocalizationResource + /// A localized `LocalizedStringResource` to display on the login action button. + public let loginActionButtonTitle: LocalizedStringResource + /// A localized`LocalizedStringResource` error message to be displayed when login fails. + public let defaultLoginFailedError: LocalizedStringResource /// Creates a localization configuration for login views. /// /// - Parameters: - /// - buttonTitle: A localized `String` to display on the login button. - /// - navigationTitle: A localized `String` for the login view's navigation title. + /// - buttonTitle: A localized `LocalizedStringResource` to display on the login button. + /// - navigationTitle: A localized `LocalizedStringResource` for the login view's navigation title. /// - username: A `FieldLocalization` instance containing the localized title and placeholder text for the username field. /// - password: A `FieldLocalization` instance containing the localized title and placeholder text for the password field. - /// - loginActionButtonTitle: A localized `String` to display on the login action button. - /// - defaultLoginFailedError: A localized `String` error message to be displayed when login fails. + /// - loginActionButtonTitle: A localized `LocalizedStringResource` to display on the login action button. + /// - defaultLoginFailedError: A localized `LocalizedStringResource` error message to be displayed when login fails. public init( - buttonTitle: String = Login.default.buttonTitle, - navigationTitle: String = Login.default.navigationTitle, - username: FieldLocalization = Login.default.username, - password: FieldLocalization = Login.default.password, - loginActionButtonTitle: String = Login.default.loginActionButtonTitle, - defaultLoginFailedError: String = Login.default.defaultLoginFailedError + buttonTitle: LocalizedStringResource = Login.default.buttonTitle, + navigationTitle: LocalizedStringResource = Login.default.navigationTitle, + username: FieldLocalizationResource = Login.default.username, + password: FieldLocalizationResource = Login.default.password, + loginActionButtonTitle: LocalizedStringResource = Login.default.loginActionButtonTitle, + defaultLoginFailedError: LocalizedStringResource = Login.default.defaultLoginFailedError ) { - self.buttonTitle = buttonTitle.localized - self.navigationTitle = navigationTitle.localized + self.buttonTitle = buttonTitle + self.navigationTitle = navigationTitle self.username = username self.password = password - self.loginActionButtonTitle = loginActionButtonTitle.localized - self.defaultLoginFailedError = defaultLoginFailedError.localized + self.loginActionButtonTitle = loginActionButtonTitle + self.defaultLoginFailedError = defaultLoginFailedError } } } diff --git a/Sources/SpeziAccount/Username and Password/Localization/Localization+ResetPassword.swift b/Sources/SpeziAccount/Username and Password/Localization/Localization+ResetPassword.swift index 6759e749..402713a1 100644 --- a/Sources/SpeziAccount/Username and Password/Localization/Localization+ResetPassword.swift +++ b/Sources/SpeziAccount/Username and Password/Localization/Localization+ResetPassword.swift @@ -6,6 +6,7 @@ // SPDX-License-Identifier: MIT // +import Foundation import SpeziViews @@ -19,7 +20,7 @@ extension Localization { /// ```swift /// ResetPassword( /// navigationTitle: "CUSTOM_NAVIGATION_TITLE", - /// username: FieldLocalization( + /// username: FieldLocalizationResource( /// title: "CUSTOM_USERNAME", /// placeholder: "CUSTOM_USERNAME_PLACEHOLDER" /// ) @@ -28,55 +29,55 @@ extension Localization { public struct ResetPassword: Codable { /// A default configuration for providing localized text to reset password views public static let `default` = ResetPassword( - buttonTitle: String(moduleLocalized: "UAP_RESET_PASSWORD_BUTTON_TITLE"), - navigationTitle: String(moduleLocalized: "UAP_RESET_PASSWORD_NAVIGATION_TITLE"), - username: FieldLocalization( - title: String(moduleLocalized: "UAP_RESET_PASSWORD_USERNAME_TITLE"), - placeholder: String(moduleLocalized: "UAP_RESET_PASSWORD_USERNAME_PLACEHOLDER") + buttonTitle: LocalizedStringResource("UAP_RESET_PASSWORD_BUTTON_TITLE", bundle: .atURL(from: .module)), + navigationTitle: LocalizedStringResource("UAP_RESET_PASSWORD_NAVIGATION_TITLE", bundle: .atURL(from: .module)), + username: FieldLocalizationResource( + title: LocalizedStringResource("UAP_RESET_PASSWORD_USERNAME_TITLE", bundle: .atURL(from: .module)), + placeholder: LocalizedStringResource("UAP_RESET_PASSWORD_USERNAME_PLACEHOLDER", bundle: .atURL(from: .module)) ), - resetPasswordActionButtonTitle: String(moduleLocalized: "UAP_RESET_PASSWORD_ACTION_BUTTON_TITLE"), - processSuccessfulLabel: String(moduleLocalized: "UAP_RESET_PASSWORD_PROCESS_SUCCESSFUL_LABEL"), - defaultResetPasswordFailedError: String(moduleLocalized: "UAP_RESET_PASSWORD_FAILED_DEFAULT_ERROR") + resetPasswordActionButtonTitle: LocalizedStringResource("UAP_RESET_PASSWORD_ACTION_BUTTON_TITLE", bundle: .atURL(from: .module)), + processSuccessfulLabel: LocalizedStringResource("UAP_RESET_PASSWORD_PROCESS_SUCCESSFUL_LABEL", bundle: .atURL(from: .module)), + defaultResetPasswordFailedError: LocalizedStringResource("UAP_RESET_PASSWORD_FAILED_DEFAULT_ERROR", bundle: .atURL(from: .module)) ) - /// A localized `String` to display on the reset password button. - public let buttonTitle: String - /// A localized `String` for the reset password view's navigation title. - public let navigationTitle: String - /// A `FieldLocalization` instance containing the localized title and placeholder text for the username field. - public let username: FieldLocalization - /// A localized `String` to display on the reset password action button. - public let resetPasswordActionButtonTitle: String - /// A localized `String` to display when the reset password process has been successful. - public let processSuccessfulLabel: String - /// A localized `String` to display when the reset password process has failed. - public let defaultResetPasswordFailedError: String + /// A localized `LocalizedStringResource` to display on the reset password button. + public let buttonTitle: LocalizedStringResource + /// A localized `LocalizedStringResource` for the reset password view's navigation title. + public let navigationTitle: LocalizedStringResource + /// A `FieldLocalizationResource` instance containing the localized title and placeholder text for the username field. + public let username: FieldLocalizationResource + /// A localized `LocalizedStringResource` to display on the reset password action button. + public let resetPasswordActionButtonTitle: LocalizedStringResource + /// A localized `LocalizedStringResource` to display when the reset password process has been successful. + public let processSuccessfulLabel: LocalizedStringResource + /// A localized `LocalizedStringResource` to display when the reset password process has failed. + public let defaultResetPasswordFailedError: LocalizedStringResource /// Creates a localization configuration for reset password views. /// /// - Parameters: - /// - buttonTitle: A localized `String` title for the reset password button. - /// - navigationTitle: A localized `String` for the reset password view's navigation title. - /// - username: A `FieldLocalization` instance containing the localized title and placeholder text for the username field. - /// - resetPasswordActionbuttonTitle: A localized `String` to display on the reset password action button. - /// - processSuccessfulLabel: A localized `String` to display when the reset password process has been successful. - /// - defaultResetPasswordFailedError: A localized `String` to display when the reset password process has failed. + /// - buttonTitle: A localized `LocalizedStringResource` title for the reset password button. + /// - navigationTitle: A localized `LocalizedStringResource` for the reset password view's navigation title. + /// - username: A `FieldLocalizationResource` instance containing the localized title and placeholder text for the username field. + /// - resetPasswordActionbuttonTitle: A localized `LocalizedStringResource` to display on the reset password action button. + /// - processSuccessfulLabel: A localized `LocalizedStringResource` to display when the reset password process has been successful. + /// - defaultResetPasswordFailedError: A localized `LocalizedStringResource` to display when the reset password process has failed. public init( - buttonTitle: String = ResetPassword.default.buttonTitle, - navigationTitle: String = ResetPassword.default.navigationTitle, - username: FieldLocalization = ResetPassword.default.username, - resetPasswordActionButtonTitle: String = ResetPassword.default.resetPasswordActionButtonTitle, - processSuccessfulLabel: String = ResetPassword.default.processSuccessfulLabel, - defaultResetPasswordFailedError: String = ResetPassword.default.defaultResetPasswordFailedError + buttonTitle: LocalizedStringResource = ResetPassword.default.buttonTitle, + navigationTitle: LocalizedStringResource = ResetPassword.default.navigationTitle, + username: FieldLocalizationResource = ResetPassword.default.username, + resetPasswordActionButtonTitle: LocalizedStringResource = ResetPassword.default.resetPasswordActionButtonTitle, + processSuccessfulLabel: LocalizedStringResource = ResetPassword.default.processSuccessfulLabel, + defaultResetPasswordFailedError: LocalizedStringResource = ResetPassword.default.defaultResetPasswordFailedError ) { - self.buttonTitle = buttonTitle.localized - self.navigationTitle = navigationTitle.localized + self.buttonTitle = buttonTitle + self.navigationTitle = navigationTitle self.username = username - self.resetPasswordActionButtonTitle = resetPasswordActionButtonTitle.localized - self.processSuccessfulLabel = processSuccessfulLabel.localized - self.defaultResetPasswordFailedError = defaultResetPasswordFailedError.localized + self.resetPasswordActionButtonTitle = resetPasswordActionButtonTitle + self.processSuccessfulLabel = processSuccessfulLabel + self.defaultResetPasswordFailedError = defaultResetPasswordFailedError } } } diff --git a/Sources/SpeziAccount/Username and Password/Localization/Localization+SignUp.swift b/Sources/SpeziAccount/Username and Password/Localization/Localization+SignUp.swift index d810afbd..a67b135d 100644 --- a/Sources/SpeziAccount/Username and Password/Localization/Localization+SignUp.swift +++ b/Sources/SpeziAccount/Username and Password/Localization/Localization+SignUp.swift @@ -6,6 +6,7 @@ // SPDX-License-Identifier: MIT // +import Foundation import SpeziViews @@ -19,7 +20,7 @@ extension Localization { /// ```swift /// SignUp( /// navigationTitle: "CUSTOM_NAVIGATION_TITLE", - /// username: FieldLocalization( + /// username: FieldLocalizationResource( /// title: "CUSTOM_USERNAME", /// placeholder: "CUSTOM_USERNAME_PLACEHOLDER" /// ) @@ -28,103 +29,103 @@ extension Localization { public struct SignUp: Codable { /// A default configuration for providing localized text to sign up views. public static let `default` = SignUp( - buttonTitle: String(moduleLocalized: "UAP_SIGNUP_BUTTION_TITLE"), - navigationTitle: String(moduleLocalized: "UAP_SIGNUP_NAVIGATION_TITLE"), - username: FieldLocalization( - title: String(moduleLocalized: "UAP_SIGNUP_USERNAME_TITLE"), - placeholder: String(moduleLocalized: "UAP_SIGNUP_USERNAME_PLACEHOLDER") + buttonTitle: LocalizedStringResource("UAP_SIGNUP_BUTTION_TITLE", bundle: .atURL(from: .module)), + navigationTitle: LocalizedStringResource("UAP_SIGNUP_NAVIGATION_TITLE", bundle: .atURL(from: .module)), + username: FieldLocalizationResource( + title: LocalizedStringResource("UAP_SIGNUP_USERNAME_TITLE", bundle: .atURL(from: .module)), + placeholder: LocalizedStringResource("UAP_SIGNUP_USERNAME_PLACEHOLDER", bundle: .atURL(from: .module)) ), - password: FieldLocalization( - title: String(moduleLocalized: "UAP_SIGNUP_PASSWORD_TITLE"), - placeholder: String(moduleLocalized: "UAP_SIGNUP_PASSWORD_PLACEHOLDER") + password: FieldLocalizationResource( + title: LocalizedStringResource("UAP_SIGNUP_PASSWORD_TITLE", bundle: .atURL(from: .module)), + placeholder: LocalizedStringResource("UAP_SIGNUP_PASSWORD_PLACEHOLDER", bundle: .atURL(from: .module)) ), - passwordRepeat: FieldLocalization( - title: String(moduleLocalized: "UAP_SIGNUP_PASSWORD_REPEAT_TITLE"), - placeholder: String(moduleLocalized: "UAP_SIGNUP_PASSWORD_REPEAT_PLACEHOLDER") + passwordRepeat: FieldLocalizationResource( + title: LocalizedStringResource("UAP_SIGNUP_PASSWORD_REPEAT_TITLE", bundle: .atURL(from: .module)), + placeholder: LocalizedStringResource("UAP_SIGNUP_PASSWORD_REPEAT_PLACEHOLDER", bundle: .atURL(from: .module)) ), - passwordNotEqualError: String(moduleLocalized: "UAP_SIGNUP_PASSWORD_NOT_EQUAL_ERROR"), - givenName: FieldLocalization( - title: String(moduleLocalized: "UAP_SIGNUP_GIVEN_NAME_TITLE"), - placeholder: String(moduleLocalized: "UAP_SIGNUP_GIVEN_NAME_PLACEHOLDER") + passwordNotEqualError: LocalizedStringResource("UAP_SIGNUP_PASSWORD_NOT_EQUAL_ERROR", bundle: .atURL(from: .module)), + givenName: FieldLocalizationResource( + title: LocalizedStringResource("UAP_SIGNUP_GIVEN_NAME_TITLE", bundle: .atURL(from: .module)), + placeholder: LocalizedStringResource("UAP_SIGNUP_GIVEN_NAME_PLACEHOLDER", bundle: .atURL(from: .module)) ), - familyName: FieldLocalization( - title: String(moduleLocalized: "UAP_SIGNUP_FAMILY_NAME_TITLE"), - placeholder: String(moduleLocalized: "UAP_SIGNUP_FAMILY_NAME_PLACEHOLDER") + familyName: FieldLocalizationResource( + title: LocalizedStringResource("UAP_SIGNUP_FAMILY_NAME_TITLE", bundle: .atURL(from: .module)), + placeholder: LocalizedStringResource("UAP_SIGNUP_FAMILY_NAME_PLACEHOLDER", bundle: .atURL(from: .module)) ), - genderIdentityTitle: String(moduleLocalized: "UAP_SIGNUP_GENDER_IDENTITY_TITLE"), - dateOfBirthTitle: String(moduleLocalized: "UAP_SIGNUP_DATE_OF_BIRTH_TITLE"), - signUpActionButtonTitle: String(moduleLocalized: "UAP_SIGNUP_ACTION_BUTTON_TITLE"), - defaultSignUpFailedError: String(moduleLocalized: "UAP_SIGNUP_FAILED_DEFAULT_ERROR") + genderIdentityTitle: LocalizedStringResource("UAP_SIGNUP_GENDER_IDENTITY_TITLE", bundle: .atURL(from: .module)), + dateOfBirthTitle: LocalizedStringResource("UAP_SIGNUP_DATE_OF_BIRTH_TITLE", bundle: .atURL(from: .module)), + signUpActionButtonTitle: LocalizedStringResource("UAP_SIGNUP_ACTION_BUTTON_TITLE", bundle: .atURL(from: .module)), + defaultSignUpFailedError: LocalizedStringResource("UAP_SIGNUP_FAILED_DEFAULT_ERROR", bundle: .atURL(from: .module)) ) - /// A localized `String` to display on the sign up button. - public let buttonTitle: String - /// A localized `String` for sign up view's localized navigation title. - public let navigationTitle: String - /// A `FieldLocalization` instance containing the localized title and placeholder text for the username field. - public let username: FieldLocalization - /// A `FieldLocalization` instance containing the localized title and placeholder text for the password field. - public let password: FieldLocalization - /// A `FieldLocalization` instance containing the localized title and placeholder text for the password repeat field. - public let passwordRepeat: FieldLocalization - /// A localized`String` error message to be displayed when the text in the password and password repeat fields are not equal. - public let passwordNotEqualError: String - /// A `FieldLocalization` instance containing the localized title and placeholder text for the given name (first name) field. - public let givenName: FieldLocalization - /// A `FieldLocalization` instance containing the localized title and placeholder text for the family name (last name) field. - public let familyName: FieldLocalization - /// A localized `String` label for the gender identity field. - public let genderIdentityTitle: String - /// A localized `String` label for the date of birth field. - public let dateOfBirthTitle: String - /// A localized `String` title for the sign up action button. - public let signUpActionButtonTitle: String - /// A localized `String` message to display when sign up fails. - public let defaultSignUpFailedError: String + /// A localized `LocalizedStringResource` to display on the sign up button. + public let buttonTitle: LocalizedStringResource + /// A localized `LocalizedStringResource` for sign up view's localized navigation title. + public let navigationTitle: LocalizedStringResource + /// A `FieldLocalizationResource` instance containing the localized title and placeholder text for the username field. + public let username: FieldLocalizationResource + /// A `FieldLocalizationResource` instance containing the localized title and placeholder text for the password field. + public let password: FieldLocalizationResource + /// A `FieldLocalizationResource` instance containing the localized title and placeholder text for the password repeat field. + public let passwordRepeat: FieldLocalizationResource + /// A localized`LocalizedStringResource` error message to be displayed when the text in the password and password repeat fields are not equal. + public let passwordNotEqualError: LocalizedStringResource + /// A `FieldLocalizationResource` instance containing the localized title and placeholder text for the given name (first name) field. + public let givenName: FieldLocalizationResource + /// A `FieldLocalizationResource` instance containing the localized title and placeholder text for the family name (last name) field. + public let familyName: FieldLocalizationResource + /// A localized `LocalizedStringResource` label for the gender identity field. + public let genderIdentityTitle: LocalizedStringResource + /// A localized `LocalizedStringResource` label for the date of birth field. + public let dateOfBirthTitle: LocalizedStringResource + /// A localized `LocalizedStringResource` title for the sign up action button. + public let signUpActionButtonTitle: LocalizedStringResource + /// A localized `LocalizedStringResource` message to display when sign up fails. + public let defaultSignUpFailedError: LocalizedStringResource /// Creates a localization configuration for signup views. /// /// - Parameters: - /// - buttonTitle: A localized `String` to display on the sign up button. - /// - navigationTitle: A localized `String` for sign up view's localized navigation title. - /// - username: A `FieldLocalization` instance containing the localized title and placeholder text for the username field. - /// - password: A `FieldLocalization` instance containing the localized title and placeholder text for the password field. - /// - passwordRepeat: A `FieldLocalization` instance containing the localized title and placeholder text for the password repeat field. - /// - passwordNotEqualError: A localized`String` error message to be displayed when the text in the password and password repeat fields are not equal. - /// - givenName: A `FieldLocalization` instance containing the localized title and placeholder text for the given name (first name) field. - /// - familyName: A `FieldLocalization` instance containing the localized title and placeholder text for the family name (last name) field. - /// - genderIdentityTitle: A localized `String` label for the gender identity field. - /// - dateOfBirthTitle: A localized `String` label for the date of birth field. - /// - signUpActionButtonTitle: A localized `String` title for the sign up action button. - /// - defaultSignUpFailedError: A localized `String` message to display when sign up fails. + /// - buttonTitle: A localized `LocalizedStringResource` to display on the sign up button. + /// - navigationTitle: A localized `LocalizedStringResource` for sign up view's localized navigation title. + /// - username: A `FieldLocalizationResource` instance containing the localized title and placeholder text for the username field. + /// - password: A `FieldLocalizationResource` instance containing the localized title and placeholder text for the password field. + /// - passwordRepeat: A `FieldLocalizationResource` instance containing the localized title and placeholder text for the password repeat field. + /// - passwordNotEqualError: A localized`LocalizedStringResource` error message to be displayed when the text in the password and password repeat fields are not equal. + /// - givenName: A `FieldLocalizationResource` instance containing the localized title and placeholder text for the given name (first name) field. + /// - familyName: A `FieldLocalizationResource` instance containing the localized title and placeholder text for the family name (last name) field. + /// - genderIdentityTitle: A localized `LocalizedStringResource` label for the gender identity field. + /// - dateOfBirthTitle: A localized `LocalizedStringResource` label for the date of birth field. + /// - signUpActionButtonTitle: A localized `LocalizedStringResource` title for the sign up action button. + /// - defaultSignUpFailedError: A localized `LocalizedStringResource` message to display when sign up fails. public init( - buttonTitle: String = SignUp.default.buttonTitle, - navigationTitle: String = SignUp.default.navigationTitle, - username: FieldLocalization = SignUp.default.username, - password: FieldLocalization = SignUp.default.password, - passwordRepeat: FieldLocalization = SignUp.default.passwordRepeat, - passwordNotEqualError: String = SignUp.default.passwordNotEqualError, - givenName: FieldLocalization = SignUp.default.givenName, - familyName: FieldLocalization = SignUp.default.familyName, - genderIdentityTitle: String = SignUp.default.genderIdentityTitle, - dateOfBirthTitle: String = SignUp.default.dateOfBirthTitle, - signUpActionButtonTitle: String = SignUp.default.signUpActionButtonTitle, - defaultSignUpFailedError: String = SignUp.default.defaultSignUpFailedError + buttonTitle: LocalizedStringResource = SignUp.default.buttonTitle, + navigationTitle: LocalizedStringResource = SignUp.default.navigationTitle, + username: FieldLocalizationResource = SignUp.default.username, + password: FieldLocalizationResource = SignUp.default.password, + passwordRepeat: FieldLocalizationResource = SignUp.default.passwordRepeat, + passwordNotEqualError: LocalizedStringResource = SignUp.default.passwordNotEqualError, + givenName: FieldLocalizationResource = SignUp.default.givenName, + familyName: FieldLocalizationResource = SignUp.default.familyName, + genderIdentityTitle: LocalizedStringResource = SignUp.default.genderIdentityTitle, + dateOfBirthTitle: LocalizedStringResource = SignUp.default.dateOfBirthTitle, + signUpActionButtonTitle: LocalizedStringResource = SignUp.default.signUpActionButtonTitle, + defaultSignUpFailedError: LocalizedStringResource = SignUp.default.defaultSignUpFailedError ) { - self.buttonTitle = buttonTitle.localized - self.navigationTitle = navigationTitle.localized + self.buttonTitle = buttonTitle + self.navigationTitle = navigationTitle self.username = username self.password = password self.passwordRepeat = passwordRepeat - self.passwordNotEqualError = passwordNotEqualError.localized + self.passwordNotEqualError = passwordNotEqualError self.givenName = givenName self.familyName = familyName - self.genderIdentityTitle = genderIdentityTitle.localized - self.dateOfBirthTitle = dateOfBirthTitle.localized - self.signUpActionButtonTitle = signUpActionButtonTitle.localized - self.defaultSignUpFailedError = defaultSignUpFailedError.localized + self.genderIdentityTitle = genderIdentityTitle + self.dateOfBirthTitle = dateOfBirthTitle + self.signUpActionButtonTitle = signUpActionButtonTitle + self.defaultSignUpFailedError = defaultSignUpFailedError } } } diff --git a/Sources/SpeziAccount/Username and Password/Localization/String+ModuleLocalization.swift b/Sources/SpeziAccount/Username and Password/Localization/String+ModuleLocalization.swift deleted file mode 100644 index 1a1bdd19..00000000 --- a/Sources/SpeziAccount/Username and Password/Localization/String+ModuleLocalization.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// This source file is part of the Spezi open-source project -// -// SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md) -// -// SPDX-License-Identifier: MIT -// - - -extension String { - init(moduleLocalized: String.LocalizationValue) { - self.init(localized: moduleLocalized, bundle: .module) - } -} diff --git a/Sources/SpeziAccount/Username and Password/Login/UsernamePasswordLoginView.swift b/Sources/SpeziAccount/Username and Password/Login/UsernamePasswordLoginView.swift index 15253e70..96f5766e 100644 --- a/Sources/SpeziAccount/Username and Password/Login/UsernamePasswordLoginView.swift +++ b/Sources/SpeziAccount/Username and Password/Login/UsernamePasswordLoginView.swift @@ -73,7 +73,7 @@ public struct UsernamePasswordLoginView: View { ) footer } - .navigationTitle(navigationTitle) + .navigationTitle(navigationTitle.localizedString()) } private var usernamePasswordSection: some View { @@ -112,7 +112,7 @@ public struct UsernamePasswordLoginView: View { .padding(.vertical, 12) } - private var loginButtonTitleLocalization: String { + private var loginButtonTitleLocalization: LocalizedStringResource { switch localization { case .environment: return usernamePasswordAccountService.localization.login.loginActionButtonTitle @@ -121,7 +121,7 @@ public struct UsernamePasswordLoginView: View { } } - private var navigationTitle: String { + private var navigationTitle: LocalizedStringResource { switch localization { case .environment: return usernamePasswordAccountService.localization.login.navigationTitle @@ -130,7 +130,7 @@ public struct UsernamePasswordLoginView: View { } } - private var defaultLoginFailedError: String { + private var defaultLoginFailedError: LocalizedStringResource { switch localization { case .environment: return usernamePasswordAccountService.localization.login.defaultLoginFailedError diff --git a/Sources/SpeziAccount/Username and Password/ResetPassword/UsernamePasswordResetPasswordView.swift b/Sources/SpeziAccount/Username and Password/ResetPassword/UsernamePasswordResetPasswordView.swift index 90fa6d84..bc220189 100644 --- a/Sources/SpeziAccount/Username and Password/ResetPassword/UsernamePasswordResetPasswordView.swift +++ b/Sources/SpeziAccount/Username and Password/ResetPassword/UsernamePasswordResetPasswordView.swift @@ -81,11 +81,11 @@ public struct UsernamePasswordResetPasswordView: View { ) } } - .navigationTitle(navigationTitle) + .navigationTitle(navigationTitle.localizedString()) } private var usernameTextField: some View { - let usernameLocalization: FieldLocalization + let usernameLocalization: FieldLocalizationResource switch localization { case .environment: usernameLocalization = usernamePasswordAccountService.localization.resetPassword.username @@ -117,7 +117,7 @@ public struct UsernamePasswordResetPasswordView: View { .padding(.vertical, 12) } - private var resetPasswordButtonTitleLocalization: String { + private var resetPasswordButtonTitleLocalization: LocalizedStringResource { switch localization { case .environment: return usernamePasswordAccountService.localization.resetPassword.resetPasswordActionButtonTitle @@ -126,7 +126,7 @@ public struct UsernamePasswordResetPasswordView: View { } } - private var navigationTitle: String { + private var navigationTitle: LocalizedStringResource { switch localization { case .environment: return usernamePasswordAccountService.localization.resetPassword.navigationTitle @@ -135,7 +135,7 @@ public struct UsernamePasswordResetPasswordView: View { } } - private var defaultResetPasswordFailedError: String { + private var defaultResetPasswordFailedError: LocalizedStringResource { switch localization { case .environment: return usernamePasswordAccountService.localization.resetPassword.defaultResetPasswordFailedError diff --git a/Sources/SpeziAccount/Username and Password/Shared/DataEntryAccountView.swift b/Sources/SpeziAccount/Username and Password/Shared/DataEntryAccountView.swift index 8d2757ba..49f43305 100644 --- a/Sources/SpeziAccount/Username and Password/Shared/DataEntryAccountView.swift +++ b/Sources/SpeziAccount/Username and Password/Shared/DataEntryAccountView.swift @@ -12,10 +12,10 @@ import SwiftUI struct DataEntryAccountView: View { private let content: AnyView - private let buttonTitle: String + private let buttonTitle: LocalizedStringResource private let buttonPressed: () async throws -> Void private let footer: AnyView - private let defaultError: String + private let defaultError: LocalizedStringResource @Binding private var valid: Bool @FocusState private var focusedField: AccountInputFields? @@ -57,8 +57,8 @@ struct DataEntryAccountView: View { init( - buttonTitle: String, - defaultError: String, + buttonTitle: LocalizedStringResource, + defaultError: LocalizedStringResource, focusState: FocusState = FocusState(), valid: Binding = .constant(true), buttonPressed: @escaping () async throws -> Void, diff --git a/Sources/SpeziAccount/Username and Password/Shared/UsernamePasswordFields.swift b/Sources/SpeziAccount/Username and Password/Shared/UsernamePasswordFields.swift index 0e09d085..c29cbc54 100644 --- a/Sources/SpeziAccount/Username and Password/Shared/UsernamePasswordFields.swift +++ b/Sources/SpeziAccount/Username and Password/Shared/UsernamePasswordFields.swift @@ -13,16 +13,16 @@ import SwiftUI struct UsernamePasswordFields: View { enum PresentationType { case login(ConfigurableLocalization<( - username: FieldLocalization, - password: FieldLocalization + username: FieldLocalizationResource, + password: FieldLocalizationResource )>) // We do not introduce an explicit type for the temporary usage of the localization fields. // swiftlint:disable:next large_tuple case signUp(ConfigurableLocalization<( - username: FieldLocalization, - password: FieldLocalization, - passwordRepeat: FieldLocalization, - passwordNotEqualError: String + username: FieldLocalizationResource, + password: FieldLocalizationResource, + passwordRepeat: FieldLocalizationResource, + passwordNotEqualError: LocalizedStringResource )>) @@ -43,7 +43,7 @@ struct UsernamePasswordFields: View { } - var username: FieldLocalization? { + var username: FieldLocalizationResource? { switch self { case let .login(.value((username, _))), let .signUp(.value((username, _, _, _))): return username @@ -52,7 +52,7 @@ struct UsernamePasswordFields: View { } } - var password: FieldLocalization? { + var password: FieldLocalizationResource? { switch self { case let .login(.value((_, password))), let .signUp(.value((_, password, _, _))): return password @@ -61,7 +61,7 @@ struct UsernamePasswordFields: View { } } - var passwordRepeat: FieldLocalization? { + var passwordRepeat: FieldLocalizationResource? { switch self { case let .signUp(.value((_, _, passwordRepeat, _))): return passwordRepeat @@ -70,7 +70,7 @@ struct UsernamePasswordFields: View { } } - var passwordNotEqualError: String? { + var passwordNotEqualError: LocalizedStringResource? { switch self { case let .signUp(.value((_, _, _, passwordNotEqualError))): return passwordNotEqualError @@ -128,7 +128,7 @@ struct UsernamePasswordFields: View { } private var usernameTextField: some View { - let usernameLocalization: FieldLocalization + let usernameLocalization: FieldLocalizationResource if let username = presentationType.username { usernameLocalization = username } else { @@ -161,7 +161,7 @@ struct UsernamePasswordFields: View { } private var passwordSecureField: some View { - let passwordLocalization: FieldLocalization + let passwordLocalization: FieldLocalizationResource if let password = presentationType.password { passwordLocalization = password } else { @@ -193,7 +193,7 @@ struct UsernamePasswordFields: View { } private var passwordRepeatSecureField: some View { - let passwordRepeatLocalization: FieldLocalization + let passwordRepeatLocalization: FieldLocalizationResource if let passwordRepeat = presentationType.passwordRepeat { passwordRepeatLocalization = passwordRepeat } else { @@ -205,7 +205,7 @@ struct UsernamePasswordFields: View { } } - let passwordNotEqualErrorLocalization: String + let passwordNotEqualErrorLocalization: LocalizedStringResource if let passwordNotEqualError = presentationType.passwordNotEqualError { passwordNotEqualErrorLocalization = passwordNotEqualError } else { diff --git a/Sources/SpeziAccount/Username and Password/Sign Up/DateOfBirthPicker.swift b/Sources/SpeziAccount/Username and Password/Sign Up/DateOfBirthPicker.swift index 4816b6f8..7ed2a257 100644 --- a/Sources/SpeziAccount/Username and Password/Sign Up/DateOfBirthPicker.swift +++ b/Sources/SpeziAccount/Username and Password/Sign Up/DateOfBirthPicker.swift @@ -6,16 +6,17 @@ // SPDX-License-Identifier: MIT // +import Foundation import SwiftUI struct DateOfBirthPicker: View { @Binding private var date: Date @EnvironmentObject private var localizationEnvironmentObject: UsernamePasswordAccountService - private let localization: ConfigurableLocalization + private let localization: ConfigurableLocalization - private var dateOfBirthTitle: String { + private var dateOfBirthTitle: LocalizedStringResource { switch localization { case .environment: return localizationEnvironmentObject.localization.signUp.dateOfBirthTitle @@ -50,7 +51,7 @@ struct DateOfBirthPicker: View { } - init(date: Binding, title: String) { + init(date: Binding, title: LocalizedStringResource) { self._date = date self.localization = .value(title) } diff --git a/Sources/SpeziAccount/Username and Password/Sign Up/GenderIdentityPicker.swift b/Sources/SpeziAccount/Username and Password/Sign Up/GenderIdentityPicker.swift index aa132b0b..d9b341db 100644 --- a/Sources/SpeziAccount/Username and Password/Sign Up/GenderIdentityPicker.swift +++ b/Sources/SpeziAccount/Username and Password/Sign Up/GenderIdentityPicker.swift @@ -12,10 +12,10 @@ import SwiftUI struct GenderIdentityPicker: View { @Binding private var genderIdentity: GenderIdentity @EnvironmentObject private var localizationEnvironmentObject: UsernamePasswordAccountService - private let localization: ConfigurableLocalization + private let localization: ConfigurableLocalization - private var genderIdentityTitle: String { + private var genderIdentityTitle: LocalizedStringResource { switch localization { case .environment: return localizationEnvironmentObject.localization.signUp.genderIdentityTitle @@ -40,7 +40,7 @@ struct GenderIdentityPicker: View { } - init(genderIdentity: Binding, title: String) { + init(genderIdentity: Binding, title: LocalizedStringResource) { self._genderIdentity = genderIdentity self.localization = .value(title) } diff --git a/Sources/SpeziAccount/Username and Password/Sign Up/NameTextFields.swift b/Sources/SpeziAccount/Username and Password/Sign Up/NameTextFields.swift index f1c7a746..daec8b24 100644 --- a/Sources/SpeziAccount/Username and Password/Sign Up/NameTextFields.swift +++ b/Sources/SpeziAccount/Username and Password/Sign Up/NameTextFields.swift @@ -15,12 +15,12 @@ struct NameTextFields: View { @FocusState private var focusedField: AccountInputFields? @EnvironmentObject var localizationEnvironmentObject: UsernamePasswordAccountService private let localization: ConfigurableLocalization<( - givenName: FieldLocalization, - familyName: FieldLocalization + givenName: FieldLocalizationResource, + familyName: FieldLocalizationResource )> - private var givenName: FieldLocalization { + private var givenName: FieldLocalizationResource { switch localization { case .environment: return localizationEnvironmentObject.localization.signUp.givenName @@ -29,7 +29,7 @@ struct NameTextFields: View { } } - private var familyName: FieldLocalization { + private var familyName: FieldLocalizationResource { switch localization { case .environment: return localizationEnvironmentObject.localization.signUp.familyName @@ -53,8 +53,8 @@ struct NameTextFields: View { init( name: Binding, - givenName: FieldLocalization, - familyName: FieldLocalization, + givenName: FieldLocalizationResource, + familyName: FieldLocalizationResource, focusState: FocusState = FocusState() ) { self._name = name diff --git a/Sources/SpeziAccount/Username and Password/Sign Up/UsernamePasswordSignUpView.swift b/Sources/SpeziAccount/Username and Password/Sign Up/UsernamePasswordSignUpView.swift index 7aea3081..2d99515f 100644 --- a/Sources/SpeziAccount/Username and Password/Sign Up/UsernamePasswordSignUpView.swift +++ b/Sources/SpeziAccount/Username and Password/Sign Up/UsernamePasswordSignUpView.swift @@ -87,7 +87,7 @@ public struct UsernamePasswordSignUpView: View { signUpButton footer } - .navigationTitle(navigationTitle) + .navigationTitle(navigationTitle.localizedString()) .navigationBarBackButtonHidden(state == .processing) .viewStateAlert(state: $state) } @@ -131,7 +131,7 @@ public struct UsernamePasswordSignUpView: View { } private var signUpButton: some View { - let signUpButtonLocalization: String + let signUpButtonLocalization: LocalizedStringResource switch localization { case .environment: signUpButtonLocalization = usernamePasswordAccountService.localization.signUp.signUpActionButtonTitle @@ -158,7 +158,7 @@ public struct UsernamePasswordSignUpView: View { .listRowBackground(Color.clear) } - private var navigationTitle: String { + private var navigationTitle: LocalizedStringResource { switch localization { case .environment: return usernamePasswordAccountService.localization.signUp.navigationTitle @@ -167,7 +167,7 @@ public struct UsernamePasswordSignUpView: View { } } - private var defaultSignUpFailedError: String { + private var defaultSignUpFailedError: LocalizedStringResource { switch localization { case .environment: return usernamePasswordAccountService.localization.signUp.defaultSignUpFailedError diff --git a/Sources/SpeziAccount/Username and Password/UsernamePasswordAccountService.swift b/Sources/SpeziAccount/Username and Password/UsernamePasswordAccountService.swift index 968a6bcb..39a4e260 100644 --- a/Sources/SpeziAccount/Username and Password/UsernamePasswordAccountService.swift +++ b/Sources/SpeziAccount/Username and Password/UsernamePasswordAccountService.swift @@ -112,7 +112,7 @@ open class UsernamePasswordAccountService: @unchecked Sendable, AccountService, /// - title: The title of the button. /// - destination: The destination of the button. /// - Returns: Returns the styled button in accordance to the ``UsernamePasswordAccountService`` or its subclasses. - open func button(_ title: String, destination: V) -> AnyView { + open func button(_ title: LocalizedStringResource, destination: V) -> AnyView { AnyView( NavigationLink { destination diff --git a/Tests/UITests/TestApp.xctestplan b/Tests/UITests/TestApp.xctestplan index 8aebecc4..dceddaf1 100644 --- a/Tests/UITests/TestApp.xctestplan +++ b/Tests/UITests/TestApp.xctestplan @@ -1,7 +1,7 @@ { "configurations" : [ { - "id" : "074FA9C1-7635-4C64-BF5D-90402604CC46", + "id" : "8CD075D1-41D1-400C-AD53-416A3B9C41E2", "name" : "Default", "options" : { diff --git a/Tests/UITests/UITests.xcodeproj/project.pbxproj b/Tests/UITests/UITests.xcodeproj/project.pbxproj index 83e5f20e..352832c5 100644 --- a/Tests/UITests/UITests.xcodeproj/project.pbxproj +++ b/Tests/UITests/UITests.xcodeproj/project.pbxproj @@ -54,7 +54,7 @@ 2F6D13AC28F5F386007C25D6 /* TestAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 2FA7382B290ADFAA007ACEB9 /* TestApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestApp.swift; sourceTree = ""; }; 2FAD38BE2A455F7D00E79ED1 /* SpeziAccount */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = SpeziAccount; path = ../..; sourceTree = ""; }; - 2FB0758A299DDB9000C0B37F /* TestApp.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = TestApp.xctestplan; sourceTree = ""; }; + 2FE750C92A8720CE00723EAE /* TestApp.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = TestApp.xctestplan; sourceTree = ""; }; A9EE7D272A3357D900C2B9A9 /* EmptyAccountServicesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmptyAccountServicesTests.swift; sourceTree = ""; }; A9EE7D292A3359E800C2B9A9 /* FeatureFlags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureFlags.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -95,7 +95,7 @@ 2F6D138928F5F384007C25D6 = { isa = PBXGroup; children = ( - 2FB0758A299DDB9000C0B37F /* TestApp.xctestplan */, + 2FE750C92A8720CE00723EAE /* TestApp.xctestplan */, 2FAD38BE2A455F7D00E79ED1 /* SpeziAccount */, 2F6D139428F5F384007C25D6 /* TestApp */, 2F6D13AF28F5F386007C25D6 /* TestAppUITests */, @@ -506,118 +506,6 @@ }; name = Release; }; - 2FB07587299DDB6000C0B37F /* Test */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = TEST; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Test; - }; - 2FB07588299DDB6000C0B37F /* Test */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = 637867499T; - ENABLE_PREVIEWS = YES; - ENABLE_TESTING_SEARCH_PATHS = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.account.testapp; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Test; - }; - 2FB07589299DDB6000C0B37F /* Test */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 637867499T; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.account.testappuitests; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = TestApp; - }; - name = Test; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -625,7 +513,6 @@ isa = XCConfigurationList; buildConfigurations = ( 2F6D13B428F5F386007C25D6 /* Debug */, - 2FB07587299DDB6000C0B37F /* Test */, 2F6D13B528F5F386007C25D6 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -635,7 +522,6 @@ isa = XCConfigurationList; buildConfigurations = ( 2F6D13B728F5F386007C25D6 /* Debug */, - 2FB07588299DDB6000C0B37F /* Test */, 2F6D13B828F5F386007C25D6 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -645,7 +531,6 @@ isa = XCConfigurationList; buildConfigurations = ( 2F6D13BD28F5F386007C25D6 /* Debug */, - 2FB07589299DDB6000C0B37F /* Test */, 2F6D13BE28F5F386007C25D6 /* Release */, ); defaultConfigurationIsVisible = 0; diff --git a/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme b/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme index ad274153..ab95fb6c 100644 --- a/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme +++ b/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme @@ -1,6 +1,6 @@ - - - - + shouldUseLaunchSchemeArgsEnv = "YES">