SettingsView

struct SettingsView : View

The main SettingsView which shows a number of subviews for different purposes.

It is here that we set new usernames and toggles different settings. It also shows contact information for dIM among other things.

  • The UserDefaults for getting information from persistent storage.

    Declaration

    Swift

    let defaults: UserDefaults
  • The ChatBrain to get things from the logic layer.

    Declaration

    Swift

    @EnvironmentObject
    var chatBrain: ChatHandler { get }
  • Colorscheme for this device to show different images depending on dark or light mode.

    Declaration

    Swift

    @Environment
    var colorScheme: ColorScheme { get }
  • Declaration

    Swift

    var body: some View { get }
  • Check if a username is valid. If it is not we are not allowed to set it.

    Usernames must be 4-16 chars long and not contain spaces.

    Declaration

    Swift

    func checkValidUsername(username: String) -> Bool

    Parameters

    username

    The username to check.

    Return Value

    A boolean indicating if the username is valid.