metatext-app-ios-iphone-ipad/Views/AddIdentityView.swift

44 lines
1.2 KiB
Swift
Raw Normal View History

// Copyright © 2020 Metabolist. All rights reserved.
2021-01-08 03:29:08 +01:00
import Kingfisher
import SwiftUI
2020-09-01 09:33:49 +02:00
import ViewModels
2021-01-27 21:31:32 +01:00
struct AddIdentityView: UIViewControllerRepresentable {
let viewModelClosure: () -> AddIdentityViewModel
let displayWelcome: Bool
func makeUIViewController(context: Context) -> AddIdentityViewController {
AddIdentityViewController(viewModel: viewModelClosure(), displayWelcome: displayWelcome)
}
func updateUIViewController(_ uiViewController: AddIdentityViewController, context: Context) {
2020-09-12 09:36:59 +02:00
}
}
2020-09-10 02:52:46 +02:00
extension AddIdentityError: LocalizedError {
public var errorDescription: String? {
2021-01-17 21:24:50 +01:00
switch self {
case .unableToConnectToInstance:
return NSLocalizedString("add-identity.unable-to-connect-to-instance", comment: "")
case .instanceNotSupported:
return NSLocalizedString("add-identity.instance-not-supported", comment: "")
}
2020-09-10 02:52:46 +02:00
}
}
2020-07-31 23:40:57 +02:00
#if DEBUG
2020-09-01 09:33:49 +02:00
import PreviewViewModels
struct AddAccountView_Previews: PreviewProvider {
static var previews: some View {
2020-09-11 11:55:06 +02:00
NavigationView {
2021-01-27 21:31:32 +01:00
AddIdentityView(viewModelClosure: { RootViewModel.preview.addIdentityViewModel() }, displayWelcome: false)
2020-09-11 11:55:06 +02:00
.navigationBarTitleDisplayMode(.inline)
}
}
}
2020-07-31 23:40:57 +02:00
#endif