Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Converted by Storyboard to SwiftUI Converter - https://swiftify.com/converter/storyboard2swiftui
- import SwiftUI
- import Introspect
- // TODO: install `SwiftUI-Introspect` package from https://github.com/siteline/SwiftUI-Introspect
- // --------------------------------------------------------------------------------
- // NavAppearanceModifier
- // --------------------------------------------------------------------------------
- struct NavAppearanceModifier: ViewModifier {
- init() {
- let navBarAppearance = UINavigationBarAppearance()
- navBarAppearance.configureWithOpaqueBackground()
- UINavigationBar.appearance().prefersLargeTitles = true
- UINavigationBar.appearance().standardAppearance = navBarAppearance
- UINavigationBar.appearance().compactAppearance = navBarAppearance
- UINavigationBar.appearance().scrollEdgeAppearance = navBarAppearance
- }
- func body(content: Content) -> some View {
- content
- }
- }
- extension View {
- func navigationAppearance() -> some View {
- self.modifier(NavAppearanceModifier())
- }
- }
- // --------------------------------------------------------------------------------
- // LoginViewController
- // --------------------------------------------------------------------------------
- struct LoginView: View {
- @State private var passwordTextEdit = ""
- @State private var userNameTextEdit = ""
- var body: some View {
- NavigationView {
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- ScrollView {
- VStack() {
- Group {
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- Image("logo-ios")
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(dynamicWidth: 64, dynamicHeight: 64)
- .clipped()
- .offset(dynamicX: 8, dynamicY: 28)
- Text("Tinode")
- .frame(dynamicWidth: 160, dynamicHeight: 44, alignment: .center)
- .font(.custom("Avenir-Medium", size: 32))
- .multilineTextAlignment(.center)
- .foregroundColor(Color(red: 0.22352941, green: 0.28627452, blue: 0.67058825))
- .offset(dynamicX: 80, dynamicY: 38)
- }
- }
- .frame(dynamicWidth: 260, dynamicHeight: 120)
- .background(Color(white: 0.0, opacity: 0.0))
- Spacer().frame(dynamicHeight: 3)
- TextField("User name", text: $userNameTextEdit)
- .textFieldStyle(RoundedBorderTextFieldStyle())
- .introspectTextField(customize: { textField in
- textField.adjustsFontSizeToFitWidth = true
- textField.isSelected = true
- textField.minimumFontSize = 17.0
- textField.smartDashesType = .no
- textField.smartQuotesType = .no
- textField.spellCheckingType = .no
- })
- .frame(dynamicWidth: 260, dynamicHeight: 40)
- .font(.system(size: 18, weight: .regular))
- .disableAutocorrection(true)
- .textContentType(.username)
- Spacer().frame(dynamicHeight: 3)
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- SecureField("Password", text: $passwordTextEdit)
- .textFieldStyle(RoundedBorderTextFieldStyle())
- .introspectTextField(customize: { textField in
- textField.adjustsFontSizeToFitWidth = true
- textField.minimumFontSize = 17.0
- textField.smartDashesType = .no
- textField.smartInsertDeleteType = .no
- textField.smartQuotesType = .no
- textField.spellCheckingType = .no
- })
- .frame(dynamicWidth: 260, dynamicHeight: 40)
- .font(.system(size: 18, weight: .regular))
- .disableAutocorrection(true)
- .textContentType(.password)
- Button(action: {
- passwordVisibilityClicked()
- }) {
- Image("eye-30").foregroundColor(Color(white: 0.33333334)).layoutPriority(1.0)
- .frame(dynamicWidth: 20, dynamicHeight: 20, alignment: .center)
- }
- .aspectRatio(contentMode: .fill)
- .foregroundColor(Color.white)
- .offset(dynamicX: 210, dynamicY: 10)
- Button(action: {
- passwordVisibilityClicked()
- }) {
- Image("invisible-30").foregroundColor(Color(white: 0.33333334)).layoutPriority(1.0)
- .frame(dynamicWidth: 20, dynamicHeight: 20, alignment: .center)
- }
- .aspectRatio(contentMode: .fill)
- .foregroundColor(Color.white)
- .offset(dynamicX: 210, dynamicY: 10)
- .hidden()
- }
- }
- .frame(dynamicWidth: 260, dynamicHeight: 40)
- Spacer().frame(dynamicHeight: 3)
- Button(action: {}) {
- Text("Forgot password?").lineLimit(1).font(.system(size: 16, weight: .light))
- .frame(dynamicWidth: 260, dynamicHeight: 32, alignment: .trailing)
- }
- .font(.system(size: 16, weight: .light))
- .foregroundColor(Color(white: 0.33333334))
- Spacer().frame(dynamicHeight: 3)
- Button(action: {
- loginClicked()
- }) {
- Text("Sign In").lineLimit(1).font(.system(size: 20, weight: .medium))
- .frame(dynamicWidth: 260, dynamicHeight: 36, alignment: .center)
- }
- .aspectRatio(contentMode: .fill)
- .font(.system(size: 20, weight: .medium))
- Spacer().frame(dynamicHeight: 3)
- }
- Group {
- Button(action: {}) {
- Text("Sign Up").lineLimit(1).font(.system(size: 18, weight: .regular))
- .frame(dynamicWidth: 260, dynamicHeight: 60, alignment: .bottom)
- }
- .aspectRatio(contentMode: .fill)
- .font(.system(size: 18, weight: .regular))
- }
- }
- .frame(dynamicWidth: 260, dynamicHeight: 343)
- .offset(dynamicX: 30, dynamicY: 16)
- }
- .introspectScrollView(customize: { scrollView in
- scrollView.clipsToBounds = true
- scrollView.showsHorizontalScrollIndicator = false
- })
- .frame(dynamicWidth: 320, dynamicHeight: 522)
- .offset(dynamicX: 47, dynamicY: 0)
- }
- }
- .frame(dynamicWidth: 414, dynamicHeight: 736)
- .edgesIgnoringSafeArea(.all)
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct LoginView_Previews: PreviewProvider {
- static var previews: some View {
- LoginView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // ResetPasswordViewController
- // --------------------------------------------------------------------------------
- struct ResetPasswordView: View {
- @State private var credentialTextField = ""
- var body: some View {
- NavigationView {
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- Text("Get reset code by email or phone")
- .frame(dynamicWidth: 318, dynamicHeight: 21, alignment: .leading)
- .font(.system(size: 17, weight: .regular))
- .offset(dynamicX: 48, dynamicY: 112)
- TextField("", text: $credentialTextField)
- .textFieldStyle(RoundedBorderTextFieldStyle())
- .introspectTextField(customize: { textField in
- textField.adjustsFontSizeToFitWidth = true
- textField.minimumFontSize = 17.0
- })
- .frame(dynamicWidth: 318, dynamicHeight: 40)
- .font(.system(size: 18, weight: .regular))
- .offset(dynamicX: 48, dynamicY: 141)
- Button(action: {
- onConfirm()
- }) {
- Text("Request").lineLimit(1).font(.system(size: 20, weight: .medium))
- .frame(dynamicWidth: 75, dynamicHeight: 36, alignment: .center)
- }
- .aspectRatio(contentMode: .fill)
- .font(.system(size: 20, weight: .medium))
- .offset(dynamicX: 169.67, dynamicY: 201)
- }
- }
- .frame(dynamicWidth: 414, dynamicHeight: 736)
- .edgesIgnoringSafeArea(.all)
- .navigationTitle("Reset Password")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct ResetPasswordView_Previews: PreviewProvider {
- static var previews: some View {
- ResetPasswordView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // ChatListViewController
- // --------------------------------------------------------------------------------
- struct ChatListView: View {
- @State private var tableViewItems = ["", "", "", "", "", ""]
- @State private var selectedTableViewItem: String?
- var body: some View {
- NavigationView {
- List {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .listStyle(.plain)
- .navigationTitle("Tinode")
- .navigationBarTitleDisplayMode(.automatic)
- .navigationBarItems(leading: Button(action: {}) {
- Text("Profile")
- },
- trailing: Button(action: {}) {
- Text("New Chat")
- })
- .navigationAppearance()
- }
- }
- }
- struct ChatListView_Previews: PreviewProvider {
- static var previews: some View {
- ChatListView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // MessageViewController
- // --------------------------------------------------------------------------------
- struct MessageView: View {
- var body: some View {
- NavigationView {
- ZStack(content: {})
- .frame(dynamicWidth: 414, dynamicHeight: 736)
- .edgesIgnoringSafeArea(.all)
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct MessageView_Previews: PreviewProvider {
- static var previews: some View {
- MessageView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // ImagePreviewController
- // --------------------------------------------------------------------------------
- struct ImagePreviewView: View {
- @State private var contentTypeLabel = "image/jpeg"
- @State private var fileNameLabel = "placeholder_file_name"
- @State private var sizeLabel = "128x365; 35KB"
- var body: some View {
- NavigationView {
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- ScrollView {
- Image("")
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(dynamicWidth: 413, dynamicHeight: 593.67)
- .clipped()
- }
- .clipped()
- .frame(dynamicWidth: 413, dynamicHeight: 593.67)
- .offset(dynamicX: 0, dynamicY: 96)
- HStack() {
- VStack() {
- Text("File name:")
- .frame(dynamicWidth: 130, dynamicHeight: 20.33, alignment: .leading)
- .font(.system(size: 17, weight: .semibold))
- Spacer().frame(dynamicHeight: 0)
- Text(fileNameLabel)
- .frame(dynamicWidth: 130, dynamicHeight: 18, alignment: .leading)
- .font(.system(size: 15, weight: .regular))
- }
- .frame(dynamicWidth: 130, dynamicHeight: 38.33)
- Spacer().frame(dynamicWidth: 0)
- VStack() {
- Text("Content type:")
- .frame(dynamicWidth: 130, dynamicHeight: 20.33, alignment: .leading)
- .font(.system(size: 17, weight: .semibold))
- Spacer().frame(dynamicHeight: 0)
- Text(contentTypeLabel)
- .frame(dynamicWidth: 130, dynamicHeight: 18, alignment: .leading)
- .font(.system(size: 15, weight: .regular))
- }
- .frame(dynamicWidth: 130, dynamicHeight: 38.33)
- Spacer().frame(dynamicWidth: 0)
- VStack() {
- Text("Size:")
- .frame(dynamicWidth: 130, dynamicHeight: 20.33, alignment: .leading)
- .font(.system(size: 17, weight: .semibold))
- Spacer().frame(dynamicHeight: 0)
- Text(sizeLabel)
- .frame(dynamicWidth: 130, dynamicHeight: 18, alignment: .leading)
- .font(.system(size: 15, weight: .regular))
- }
- .frame(dynamicWidth: 130, dynamicHeight: 38.33)
- }
- .frame(dynamicWidth: 406, dynamicHeight: 38.33)
- .offset(dynamicX: 8, dynamicY: 697.67)
- }
- }
- .frame(dynamicWidth: 414, dynamicHeight: 736)
- .edgesIgnoringSafeArea(.all)
- .navigationTitle("Image Preview")
- .navigationBarTitleDisplayMode(.automatic)
- .navigationBarItems(trailing: Button(action: {}) {
- Image(systemName: "square.and.arrow.up")
- })
- }
- }
- }
- struct ImagePreviewView_Previews: PreviewProvider {
- static var previews: some View {
- ImagePreviewView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // FilePreviewController
- // --------------------------------------------------------------------------------
- struct FilePreviewView: View {
- @State private var contentTypeLabel = "image/jpeg"
- @State private var fileNameLabel = "placeholder_file_name"
- @State private var previewView = ""
- @State private var sizeLabel = "128x365; 35KB"
- var body: some View {
- NavigationView {
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- Image("")
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(dynamicWidth: 128, dynamicHeight: 128)
- .clipped()
- .offset(dynamicX: 143, dynamicY: 224)
- VStack() {
- HStack() {
- Text("File name:")
- .frame(dynamicWidth: 81, dynamicHeight: 20.33, alignment: .leading)
- .font(.system(size: 17, weight: .semibold))
- Spacer().frame(dynamicWidth: 0)
- Text(fileNameLabel)
- .frame(dynamicWidth: 155.33, dynamicHeight: 20.33, alignment: .trailing)
- .font(.system(size: 15, weight: .regular))
- .multilineTextAlignment(.trailing)
- }
- .frame(dynamicWidth: 244.33, dynamicHeight: 20.33)
- Spacer().frame(dynamicHeight: 0)
- HStack() {
- Text("Content type:")
- .frame(dynamicWidth: 109, dynamicHeight: 20.33, alignment: .leading)
- .font(.system(size: 17, weight: .semibold))
- Spacer().frame(dynamicWidth: 0)
- Text(contentTypeLabel)
- .frame(dynamicWidth: 127.33, dynamicHeight: 20.33, alignment: .trailing)
- .font(.system(size: 15, weight: .regular))
- .multilineTextAlignment(.trailing)
- }
- .frame(dynamicWidth: 244.33, dynamicHeight: 20.33)
- Spacer().frame(dynamicHeight: 0)
- HStack() {
- Text("Size: ")
- .frame(dynamicWidth: 42.67, dynamicHeight: 20.33, alignment: .leading)
- .font(.system(size: 17, weight: .semibold))
- Spacer().frame(dynamicWidth: 0)
- Text(sizeLabel)
- .frame(dynamicWidth: 193.67, dynamicHeight: 20.33, alignment: .trailing)
- .font(.system(size: 15, weight: .regular))
- .multilineTextAlignment(.trailing)
- }
- .frame(dynamicWidth: 244.33, dynamicHeight: 20.33)
- }
- .frame(dynamicWidth: 244.33, dynamicHeight: 77)
- .offset(dynamicX: 85, dynamicY: 360)
- }
- }
- .frame(dynamicWidth: 414, dynamicHeight: 576)
- .background(Color(.secondarySystemFill))
- .offset(dynamicX: 0, dynamicY: 96)
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- Button(action: {
- cancelPreviewClicked()
- }) {
- Text("")
- .frame(dynamicWidth: 24.33, dynamicHeight: 24.33, alignment: .center)
- }
- .aspectRatio(contentMode: .fill)
- .foregroundColor(Color.white)
- .offset(dynamicX: 8, dynamicY: 10)
- TextEditor(text: $previewView)
- .introspectTextView(customize: { textView in
- textView.clipsToBounds = true
- textView.isEditable = false
- textView.isSelectable = false
- })
- .frame(dynamicWidth: 318.67, dynamicHeight: 40)
- .font(.system(size: 14, weight: .regular))
- .foregroundColor(Color(.label))
- .offset(dynamicX: 40.33, dynamicY: 2)
- .allowsHitTesting(false)
- .autocapitalization(.sentences)
- }
- }
- .frame(dynamicWidth: 414, dynamicHeight: 44)
- .background(Color(.systemBackground))
- .offset(dynamicX: 0, dynamicY: 644)
- HStack(alignment: .center) {
- ZStack(content: {})
- .frame(dynamicWidth: 342, dynamicHeight: 1)
- .background(Color(.separator))
- Spacer().frame(dynamicWidth: 0)
- Button(action: {
- sendFileAttachment()
- }) {
- Image("arrow-up-48").foregroundColor(Color(white: 1.0)).layoutPriority(1.0)
- .frame(dynamicWidth: 32, dynamicHeight: 32, alignment: .center)
- }
- .aspectRatio(contentMode: .fill)
- .foregroundColor(Color.white)
- .background(Color(red: 0.2509804, green: 0.7529412, blue: 0.2509804))
- }
- .frame(dynamicWidth: 382, dynamicHeight: 32)
- .offset(dynamicX: 16, dynamicY: 688)
- }
- }
- .frame(dynamicWidth: 414, dynamicHeight: 736)
- .background(Color(.systemBackground))
- .edgesIgnoringSafeArea(.all)
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct FilePreviewView_Previews: PreviewProvider {
- static var previews: some View {
- FilePreviewView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // EditMembersViewController
- // --------------------------------------------------------------------------------
- struct EditMembersView: View {
- @State private var tableViewItems = ["", "", "", "", ""]
- @State private var selectedTableViewItem: String?
- // TODO: Replace the `minimumValue` below from the conversion result of UICollectionViewCell XIB
- let gridLayout = [GridItem(.adaptive(minimum: 150), spacing: 8)]
- @State private var collectionViewItems = ["String"]
- var body: some View {
- NavigationView {
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- ScrollView {
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- Text("GROUP MEMBERS")
- .frame(dynamicWidth: 414, dynamicHeight: 40, alignment: .leading)
- .font(.custom(".AppleSystemUIFont", size: 13))
- .background(Color(.groupTableViewBackground))
- ScrollView(.vertical) {
- LazyVGrid(columns: gridLayout, spacing: 8) {
- ForEach(collectionViewItems, id: \.self) { collectionViewItem in
- // No UICollectionViewCell cell found in the storyboard
- // If you have added the UICollectionViewCell through a `XIB`, please convert the `XIB` and use the result here.
- }
- }
- }
- .frame(dynamicWidth: 398, dynamicHeight: 92)
- .background(Color(.systemBackground))
- .clipped()
- .offset(dynamicX: 8, dynamicY: 40)
- Text("ALL USERS")
- .frame(dynamicWidth: 414, dynamicHeight: 40, alignment: .leading)
- .font(.custom(".AppleSystemUIFont", size: 13))
- .background(Color(.groupTableViewBackground))
- .offset(dynamicX: 0, dynamicY: 132)
- List {
- Section(footer: EditMembersViewControllerListFooterView()) {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .frame(dynamicWidth: 414, dynamicHeight: 488)
- .listStyle(.plain)
- .offset(dynamicX: 0, dynamicY: 172)
- }
- }
- .frame(dynamicWidth: 414, dynamicHeight: 660)
- }
- .clipped()
- .frame(dynamicWidth: 414, dynamicHeight: 660)
- .offset(dynamicX: 0, dynamicY: 56)
- }
- }
- .navigationTitle("Edit Members")
- .navigationBarTitleDisplayMode(.automatic)
- .navigationBarItems(leading: Button(action: {}) {
- Text("Cancel")
- },
- trailing: Button(action: {}) {
- Text("Save")
- })
- }
- }
- }
- struct EditMembersView_Previews: PreviewProvider {
- static var previews: some View {
- EditMembersView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // CredentialsViewController
- // --------------------------------------------------------------------------------
- struct CredentialsView: View {
- @State private var codeText = ""
- var body: some View {
- NavigationView {
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- TextField("", text: $codeText)
- .textFieldStyle(RoundedBorderTextFieldStyle())
- .introspectTextField(customize: { textField in
- textField.adjustsFontSizeToFitWidth = true
- textField.minimumFontSize = 17.0
- })
- .frame(dynamicWidth: 334, dynamicHeight: 34)
- .font(.system(size: 14, weight: .regular))
- .offset(dynamicX: 40, dynamicY: 162.33)
- Text("Confirmation code")
- .frame(dynamicWidth: 334, dynamicHeight: 50.33, alignment: .leading)
- .font(.system(size: 17, weight: .regular))
- .offset(dynamicX: 40, dynamicY: 104)
- Button(action: {
- onConfirm()
- }) {
- Text("Confirm").lineLimit(1).font(.system(size: 20, weight: .medium))
- .frame(dynamicWidth: 73, dynamicHeight: 36, alignment: .center)
- }
- .aspectRatio(contentMode: .fill)
- .font(.system(size: 20, weight: .medium))
- .offset(dynamicX: 170.67, dynamicY: 216.33)
- }
- }
- .frame(dynamicWidth: 414, dynamicHeight: 736)
- .edgesIgnoringSafeArea(.all)
- .navigationTitle("Confirm credentials")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct CredentialsView_Previews: PreviewProvider {
- static var previews: some View {
- CredentialsView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // AddByIDViewController
- // --------------------------------------------------------------------------------
- struct AddByIDView: View {
- @State private var idTextField = ""
- var body: some View {
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- Text("Topic or user ID")
- .frame(dynamicWidth: 382, dynamicHeight: 21, alignment: .leading)
- .font(.system(size: 17, weight: .regular))
- .offset(dynamicX: 16, dynamicY: 112)
- TextField("usr123aBcDef", text: $idTextField)
- .textFieldStyle(RoundedBorderTextFieldStyle())
- .introspectTextField(customize: { textField in
- textField.adjustsFontSizeToFitWidth = true
- textField.minimumFontSize = 17.0
- })
- .frame(dynamicWidth: 382, dynamicHeight: 34)
- .font(.system(size: 14, weight: .regular))
- .offset(dynamicX: 16, dynamicY: 141)
- Button(action: {
- okayClicked()
- }) {
- Text("OK").lineLimit(1).font(.system(size: 20, weight: .medium))
- .frame(dynamicWidth: 30, dynamicHeight: 36, alignment: .center)
- }
- .aspectRatio(contentMode: .fill)
- .font(.system(size: 20, weight: .medium))
- .offset(dynamicX: 192, dynamicY: 191)
- }
- }
- .frame(dynamicWidth: 414, dynamicHeight: 736)
- .edgesIgnoringSafeArea(.all)
- }
- }
- struct AddByIDView_Previews: PreviewProvider {
- static var previews: some View {
- AddByIDView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // SignupViewController
- // --------------------------------------------------------------------------------
- struct SignupView: View {
- @State private var tableViewItems = ["String", "", "", "", "", ""]
- var body: some View {
- List {
- Section(footer: SignupViewControllerListFooterView()) {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- tableView.separatorInset = UIEdgeInsets(top: 0.0, left: 18.0, bottom: 0.0, right: 18.0)
- })
- .frame(dynamicWidth: 414, dynamicHeight: 736)
- .listStyle(.plain)
- }
- }
- struct SignupView_Previews: PreviewProvider {
- static var previews: some View {
- SignupView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // SettingsPersonalViewController
- // --------------------------------------------------------------------------------
- struct SettingsPersonalView: View {
- @State private var tableViewItems = ["String", "", "", "", "", "", ""]
- @State private var selectedTableViewItem: String?
- var body: some View {
- NavigationView {
- List {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .listStyle(.grouped)
- .navigationTitle("Personal")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct SettingsPersonalView_Previews: PreviewProvider {
- static var previews: some View {
- SettingsPersonalView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // SettingsSecurityViewController
- // --------------------------------------------------------------------------------
- struct SettingsSecurityView: View {
- @State private var tableViewItems = ["", "", "", "", "", ""]
- @State private var selectedTableViewItem: String?
- var body: some View {
- NavigationView {
- List {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .listStyle(.grouped)
- .navigationTitle("Account and Security")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct SettingsSecurityView_Previews: PreviewProvider {
- static var previews: some View {
- SettingsSecurityView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // AccountSettingsViewController
- // --------------------------------------------------------------------------------
- struct AccountSettingsView: View {
- @State private var tableViewItems = [""]
- @State private var selectedTableViewItem: String?
- var body: some View {
- NavigationView {
- List {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .listStyle(.grouped)
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct AccountSettingsView_Previews: PreviewProvider {
- static var previews: some View {
- AccountSettingsView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // TopicInfoViewController
- // --------------------------------------------------------------------------------
- struct TopicInfoView: View {
- @State private var tableViewItems = ["", "", "", "", "", ""]
- @State private var selectedTableViewItem: String?
- var body: some View {
- NavigationView {
- List {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .listStyle(.grouped)
- .navigationTitle("Settings")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct TopicInfoView_Previews: PreviewProvider {
- static var previews: some View {
- TopicInfoView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // ArchivedChatsTableViewController
- // --------------------------------------------------------------------------------
- struct ArchivedChatsTableView: View {
- @State private var tableViewItems = ["", "", "", "", "", "", ""]
- @State private var selectedTableViewItem: String?
- var body: some View {
- NavigationView {
- List {
- Section(footer: ArchivedChatsTableViewControllerListFooterView()) {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .listStyle(.plain)
- .navigationTitle("Archived chats")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct ArchivedChatsTableView_Previews: PreviewProvider {
- static var previews: some View {
- ArchivedChatsTableView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // BlockedContactsTableViewController
- // --------------------------------------------------------------------------------
- struct BlockedContactsTableView: View {
- @State private var tableViewItems = ["", "", "", "", "", ""]
- var body: some View {
- NavigationView {
- List {
- Section(header: BlockedContactsTableViewControllerListHeaderView()) {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .listStyle(.plain)
- .navigationTitle("Blocked Contacts")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct BlockedContactsTableView_Previews: PreviewProvider {
- static var previews: some View {
- BlockedContactsTableView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // SettingsNotificationsViewController
- // --------------------------------------------------------------------------------
- struct SettingsNotificationsView: View {
- @State private var tableViewItems = ["", "", "", "", "", "", ""]
- @State private var selectedTableViewItem: String?
- var body: some View {
- NavigationView {
- List {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .listStyle(.grouped)
- .navigationTitle("Notifications")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct SettingsNotificationsView_Previews: PreviewProvider {
- static var previews: some View {
- SettingsNotificationsView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // SettingsHelpViewController
- // --------------------------------------------------------------------------------
- struct SettingsHelpView: View {
- @State private var tableViewItems = ["", "", "", "", "", ""]
- @State private var selectedTableViewItem: String?
- var body: some View {
- NavigationView {
- List {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .listStyle(.grouped)
- .navigationTitle("Help and About")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
- struct SettingsHelpView_Previews: PreviewProvider {
- static var previews: some View {
- SettingsHelpView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // FindViewController
- // --------------------------------------------------------------------------------
- struct FindView: View {
- @State private var tableViewItems = ["String"]
- @State private var selectedTableViewItem: String?
- var body: some View {
- List {
- Section(footer: FindViewControllerListFooterView()) {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- TableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- .modifier(SelectionModifier(checked: selectedTableViewItem == tableViewItem))
- .onTapGesture {
- selectedTableViewItem = tableViewItem
- }
- }
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .frame(dynamicWidth: 414, dynamicHeight: 736)
- .listStyle(.grouped)
- }
- }
- struct FindView_Previews: PreviewProvider {
- static var previews: some View {
- FindView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // NewGroupViewController
- // --------------------------------------------------------------------------------
- struct NewGroupView: View {
- @State private var tableViewItems = ["String", "", "", "", "", "", ""]
- @State private var selectedTableViewItem: String?
- var body: some View {
- List {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- CustomTableViewCell()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- // It seems that you do not have a UITableViewCell added from the storyboard.
- // If you have added the TableViewCell through a XIB, please convert the XIB and copy the result here.
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- tableView.separatorInset = UIEdgeInsets(top: 0.0, left: 18.0, bottom: 0.0, right: 18.0)
- })
- .frame(dynamicWidth: 414, dynamicHeight: 736)
- .listStyle(.grouped)
- }
- }
- struct NewGroupView_Previews: PreviewProvider {
- static var previews: some View {
- NewGroupView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // ForwardToViewController
- // --------------------------------------------------------------------------------
- struct ForwardToView: View {
- @State private var tableViewItems = ["", "", "", "", "", "" ]
- @State private var selectedTableViewItem: String?
- var body: some View {
- NavigationView {
- List {
- Section(footer: ForwardToViewControllerListFooterView()) {
- ForEach(tableViewItems, id: \.self) { tableViewItem in
- TableViewCell1()
- .listRowInsets(EdgeInsets())
- .contentShape(Rectangle())
- .modifier(SelectionModifier(checked: selectedTableViewItem == tableViewItem))
- .onTapGesture {
- selectedTableViewItem = tableViewItem
- }
- }
- }
- }
- .introspectTableView(customize: { tableView in
- tableView.alwaysBounceHorizontal = true
- tableView.alwaysBounceVertical = true
- tableView.clipsToBounds = true
- })
- .listStyle(.plain)
- .navigationTitle("Forward To")
- .navigationBarTitleDisplayMode(.automatic)
- .navigationBarItems(leading: Button(action: {}) {
- Text("Cancel")
- })
- }
- }
- }
- struct ForwardToView_Previews: PreviewProvider {
- static var previews: some View {
- ForwardToView()
- .previewDevice(PreviewDevice(rawValue: "iPhone 8 Plus"))
- .previewInterfaceOrientation(.portrait)
- .preferredColorScheme(.light)
- }
- }
- // --------------------------------------------------------------------------------
- // NewChatTabController
- // --------------------------------------------------------------------------------
- struct NewChatTabView: View {
- var body: some View {
- TabView {
- FindView()
- .tabItem {
- VStack {
- Image("search-25")
- Text("Find")
- }
- }
- NewGroupView()
- .tabItem {
- VStack {
- Image("new-group-25")
- Text("New Group")
- }
- }
- AddByIDView()
- .tabItem {
- VStack {
- Image("data-25")
- Text("By ID")
- }
- }
- }
- .introspectTabBarController(customize: { tabBarController in
- tabBarController.tabBar.backgroundColor = UIColor(white: 0.0, alpha: 0.0)
- })
- }
- }
- // --------------------------------------------------------------------------------
- // BlockedContactsTableViewControllerListHeaderView
- // --------------------------------------------------------------------------------
- struct BlockedContactsTableViewControllerListHeaderView: View {
- var body: some View {
- ZStack(content: {})
- .frame(dynamicWidth: 414, dynamicHeight: 0)
- .background(Color(.systemBackground))
- .listRowInsets(EdgeInsets())
- }
- }
- // --------------------------------------------------------------------------------
- // EditMembersViewControllerListFooterView
- // --------------------------------------------------------------------------------
- struct EditMembersViewControllerListFooterView: View {
- var body: some View {
- ZStack(content: {})
- .frame(dynamicWidth: 414, dynamicHeight: 100)
- .background(Color(.yellow))
- .listRowInsets(EdgeInsets())
- }
- }
- // --------------------------------------------------------------------------------
- // SignupViewControllerListFooterView
- // --------------------------------------------------------------------------------
- struct SignupViewControllerListFooterView: View {
- var body: some View {
- ZStack(content: {})
- .frame(dynamicWidth: 414, dynamicHeight: 44)
- .background(Color(white: 0.0, opacity: 0.0))
- .listRowInsets(EdgeInsets())
- }
- }
- // --------------------------------------------------------------------------------
- // ArchivedChatsTableViewControllerListFooterView
- // --------------------------------------------------------------------------------
- struct ArchivedChatsTableViewControllerListFooterView: View {
- var body: some View {
- ZStack(content: {})
- .frame(dynamicWidth: 414, dynamicHeight: 0)
- .listRowInsets(EdgeInsets())
- }
- }
- // --------------------------------------------------------------------------------
- // FindViewControllerListFooterView
- // --------------------------------------------------------------------------------
- struct FindViewControllerListFooterView: View {
- var body: some View {
- ZStack(content: {})
- .frame(dynamicWidth: 414, dynamicHeight: 0)
- .background(Color(white: 1.0))
- .listRowInsets(EdgeInsets())
- }
- }
- // --------------------------------------------------------------------------------
- // ForwardToViewControllerListFooterView
- // --------------------------------------------------------------------------------
- struct ForwardToViewControllerListFooterView: View {
- var body: some View {
- ZStack(content: {})
- .frame(dynamicWidth: 414, dynamicHeight: 0)
- .background(Color(white: 1.0))
- .listRowInsets(EdgeInsets())
- }
- }
- // --------------------------------------------------------------------------------
- // TableViewCell
- // --------------------------------------------------------------------------------
- struct TableViewCell: View {
- var body: some View {
- Text("No results")
- .frame(dynamicWidth: 358, dynamicHeight: 30, alignment: .center)
- .font(.system(size: 20, weight: .light))
- .multilineTextAlignment(.center)
- .foregroundColor(Color(.secondaryLabel))
- .offset(dynamicX: 28, dynamicY: 15)
- }
- }
- // --------------------------------------------------------------------------------
- // TableViewCell1
- // --------------------------------------------------------------------------------
- struct TableViewCell1: View {
- var body: some View {
- Text("No results")
- .frame(dynamicWidth: 358, dynamicHeight: 30, alignment: .center)
- .font(.system(size: 20, weight: .light))
- .multilineTextAlignment(.center)
- .foregroundColor(Color(.secondaryLabel))
- .offset(dynamicX: 28, dynamicY: 15)
- }
- }
- // --------------------------------------------------------------------------------
- // SelectionModifier
- // --------------------------------------------------------------------------------
- struct SelectionModifier: ViewModifier {
- var checked: Bool = false
- func body(content: Content) -> some View {
- Group {
- if checked {
- content
- .background(Color(UIColor.systemGroupedBackground))
- } else {
- content
- }
- }
- }
- }
- // --------------------------------------------------------------------------------
- // AddByIDView - Actions
- // --------------------------------------------------------------------------------
- extension AddByIDView {
- func okayClicked() {
- //TODO: Paste the contents of AddByIDViewController.okayClicked()
- }
- }
- // --------------------------------------------------------------------------------
- // CredentialsView - Actions
- // --------------------------------------------------------------------------------
- extension CredentialsView {
- func onConfirm() {
- //TODO: Paste the contents of CredentialsViewController.onConfirm()
- }
- }
- // --------------------------------------------------------------------------------
- // FilePreviewView - Actions
- // --------------------------------------------------------------------------------
- extension FilePreviewView {
- func cancelPreviewClicked() {
- //TODO: Paste the contents of FilePreviewController.cancelPreviewClicked()
- }
- func sendFileAttachment() {
- //TODO: Paste the contents of FilePreviewController.sendFileAttachment()
- }
- }
- // --------------------------------------------------------------------------------
- // LoginView - Actions
- // --------------------------------------------------------------------------------
- extension LoginView {
- func passwordVisibilityClicked() {
- //TODO: Paste the contents of LoginViewController.passwordVisibilityClicked()
- }
- func loginClicked() {
- //TODO: Paste the contents of LoginViewController.loginClicked()
- }
- }
- // --------------------------------------------------------------------------------
- // ResetPasswordView - Actions
- // --------------------------------------------------------------------------------
- extension ResetPasswordView {
- func onConfirm() {
- //TODO: Paste the contents of ResetPasswordViewController.onConfirm()
- }
- }
- // --------------------------------------------------------------------------------
- // Dynamic Size Helper
- // --------------------------------------------------------------------------------
- struct DynamicSize {
- static private let baseViewWidth: CGFloat = 414.0
- static private let baseViewHeight: CGFloat = 736.0
- static func getHeight(_ height: CGFloat) -> CGFloat {
- return (height / baseViewHeight) * UIScreen.main.bounds.height
- }
- static func getWidth(_ width: CGFloat) -> CGFloat {
- return (width / baseViewWidth) * UIScreen.main.bounds.width
- }
- static func getOffsetX(_ x: CGFloat) -> CGFloat {
- return (x / baseViewWidth) * UIScreen.main.bounds.width
- }
- static func getOffsetY(_ y: CGFloat) -> CGFloat {
- return (y / baseViewHeight) * UIScreen.main.bounds.height
- }
- }
- // --------------------------------------------------------------------------------
- // Frame and Offset Helper
- // --------------------------------------------------------------------------------
- extension View {
- func frame(dynamicWidth: CGFloat? = nil, dynamicHeight: CGFloat? = nil, alignment: Alignment = .center) -> some View {
- frame(
- width: DynamicSize.getWidth(dynamicWidth ?? 0),
- height: DynamicSize.getHeight(dynamicHeight ?? 0),
- alignment: alignment)
- }
- func offset(dynamicX: CGFloat = 0, dynamicY: CGFloat = 0) -> some View {
- offset(x: DynamicSize.getOffsetX(dynamicX), y: DynamicSize.getOffsetY(dynamicY))
- }
- }
- // --------------------------------------------------------------------------------
- // CustomTableViewCell
- // --------------------------------------------------------------------------------
- struct CustomTableViewCell: View {
- var body: some View {
- ZStack(alignment: .topLeading) {
- GeometryReader { geometry in
- Text("Test")
- .frame(dynamicWidth: 374, dynamicHeight: 360, alignment: .center)
- .font(.system(size: 52, weight: .regular))
- .multilineTextAlignment(.center)
- .foregroundColor(Color(white: 1.0))
- .background(Color(red: 0.7176471, green: 0.60784316, blue: 0.49411765))
- .offset(dynamicX: 20, dynamicY: 20)
- }
- }
- .frame(dynamicWidth: 414, dynamicHeight: 400)
- .background(Color(.systemPink))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement