metatext/Views/AddIdentityView.swift

44 lines
1.2 KiB
Swift
Raw Normal View History

// Copyright © 2020 Metabolist. All rights reserved.
2021-01-08 02:29:08 +00:00
import Kingfisher
import SwiftUI
2020-09-01 07:33:49 +00:00
import ViewModels
2021-01-27 20:31:32 +00: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 07:36:59 +00:00
}
}
2020-09-10 00:52:46 +00:00
extension AddIdentityError: LocalizedError {
public var errorDescription: String? {
2021-01-17 20:24:50 +00: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 00:52:46 +00:00
}
}
2020-07-31 21:40:57 +00:00
#if DEBUG
2020-09-01 07:33:49 +00:00
import PreviewViewModels
struct AddAccountView_Previews: PreviewProvider {
static var previews: some View {
2020-09-11 09:55:06 +00:00
NavigationView {
2021-01-27 20:31:32 +00:00
AddIdentityView(viewModelClosure: { RootViewModel.preview.addIdentityViewModel() }, displayWelcome: false)
2020-09-11 09:55:06 +00:00
.navigationBarTitleDisplayMode(.inline)
}
}
}
2020-07-31 21:40:57 +00:00
#endif