Refactor macOS/SettingsView tab view into MacAccountView

This commit is contained in:
Angelo Stavrow 2020-08-12 10:36:49 -04:00
parent dfbbed12f8
commit e2efecb210
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
5 changed files with 33 additions and 18 deletions

View File

@ -24,16 +24,12 @@ struct WriteFreely_MultiPlatformApp: App {
#if os(macOS) #if os(macOS)
Settings { Settings {
TabView(selection: $selectedTab) { TabView(selection: $selectedTab) {
Form { MacAccountView(account: account)
Section(header: Text("Login Details")) { .tabItem {
AccountView(account: account) Image(systemName: "person.crop.circle")
Text("Account")
} }
} .tag(0)
.tabItem {
Image(systemName: "person.crop.circle")
Text("Account")
}
.tag(0)
MacPreferencesView(preferences: preferences) MacPreferencesView(preferences: preferences)
.tabItem { .tabItem {
Image(systemName: "gear") Image(systemName: "gear")

View File

@ -34,7 +34,7 @@
1756AE8124CB844500FD7257 /* View+Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1756AE8024CB844500FD7257 /* View+Keyboard.swift */; }; 1756AE8124CB844500FD7257 /* View+Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1756AE8024CB844500FD7257 /* View+Keyboard.swift */; };
1765F62A24E18EA200C9EBF0 /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1765F62924E18EA200C9EBF0 /* SidebarView.swift */; }; 1765F62A24E18EA200C9EBF0 /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1765F62924E18EA200C9EBF0 /* SidebarView.swift */; };
1765F62B24E18EA200C9EBF0 /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1765F62924E18EA200C9EBF0 /* SidebarView.swift */; }; 1765F62B24E18EA200C9EBF0 /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1765F62924E18EA200C9EBF0 /* SidebarView.swift */; };
17A5388824DDA31F00DEFF9A /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5388724DDA31F00DEFF9A /* SettingsView.swift */; }; 17A5388824DDA31F00DEFF9A /* MacAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5388724DDA31F00DEFF9A /* MacAccountView.swift */; };
17A5388C24DDC83F00DEFF9A /* AccountModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5388B24DDC83F00DEFF9A /* AccountModel.swift */; }; 17A5388C24DDC83F00DEFF9A /* AccountModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5388B24DDC83F00DEFF9A /* AccountModel.swift */; };
17A5388F24DDEC7400DEFF9A /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5388D24DDEC7400DEFF9A /* AccountView.swift */; }; 17A5388F24DDEC7400DEFF9A /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5388D24DDEC7400DEFF9A /* AccountView.swift */; };
17A5389324DDED0000DEFF9A /* PreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5389124DDED0000DEFF9A /* PreferencesView.swift */; }; 17A5389324DDED0000DEFF9A /* PreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5389124DDED0000DEFF9A /* PreferencesView.swift */; };
@ -86,7 +86,7 @@
1756AE7924CB65DF00FD7257 /* PostList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostList.swift; sourceTree = "<group>"; }; 1756AE7924CB65DF00FD7257 /* PostList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostList.swift; sourceTree = "<group>"; };
1756AE8024CB844500FD7257 /* View+Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Keyboard.swift"; sourceTree = "<group>"; }; 1756AE8024CB844500FD7257 /* View+Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Keyboard.swift"; sourceTree = "<group>"; };
1765F62924E18EA200C9EBF0 /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = "<group>"; }; 1765F62924E18EA200C9EBF0 /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = "<group>"; };
17A5388724DDA31F00DEFF9A /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; }; 17A5388724DDA31F00DEFF9A /* MacAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacAccountView.swift; sourceTree = "<group>"; };
17A5388B24DDC83F00DEFF9A /* AccountModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountModel.swift; sourceTree = "<group>"; }; 17A5388B24DDC83F00DEFF9A /* AccountModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountModel.swift; sourceTree = "<group>"; };
17A5388D24DDEC7400DEFF9A /* AccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = "<group>"; }; 17A5388D24DDEC7400DEFF9A /* AccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = "<group>"; };
17A5389124DDED0000DEFF9A /* PreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesView.swift; sourceTree = "<group>"; }; 17A5389124DDED0000DEFF9A /* PreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesView.swift; sourceTree = "<group>"; };
@ -176,7 +176,7 @@
17A5388924DDA50500DEFF9A /* Settings */ = { 17A5388924DDA50500DEFF9A /* Settings */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
17A5388724DDA31F00DEFF9A /* SettingsView.swift */, 17A5388724DDA31F00DEFF9A /* MacAccountView.swift */,
1753F6AB24E431CC00309365 /* MacPreferencesView.swift */, 1753F6AB24E431CC00309365 /* MacPreferencesView.swift */,
); );
path = Settings; path = Settings;
@ -562,7 +562,7 @@
1756AE6C24CB1E4B00FD7257 /* Post.swift in Sources */, 1756AE6C24CB1E4B00FD7257 /* Post.swift in Sources */,
17A5388F24DDEC7400DEFF9A /* AccountView.swift in Sources */, 17A5388F24DDEC7400DEFF9A /* AccountView.swift in Sources */,
1756AE7524CB26FA00FD7257 /* PostCell.swift in Sources */, 1756AE7524CB26FA00FD7257 /* PostCell.swift in Sources */,
17A5388824DDA31F00DEFF9A /* SettingsView.swift in Sources */, 17A5388824DDA31F00DEFF9A /* MacAccountView.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -7,12 +7,12 @@
<key>WriteFreely-MultiPlatform (iOS).xcscheme_^#shared#^_</key> <key>WriteFreely-MultiPlatform (iOS).xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>0</integer> <integer>1</integer>
</dict> </dict>
<key>WriteFreely-MultiPlatform (macOS).xcscheme_^#shared#^_</key> <key>WriteFreely-MultiPlatform (macOS).xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>1</integer> <integer>0</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>

View File

@ -0,0 +1,19 @@
import SwiftUI
struct MacAccountView: View {
@ObservedObject var account: AccountModel
var body: some View {
Form {
Section(header: Text("Login Details")) {
AccountView(account: account)
}
}
}
}
struct MacAccountView_Previews: PreviewProvider {
static var previews: some View {
MacAccountView(account: AccountModel())
}
}

View File

@ -1,6 +1,6 @@
import SwiftUI import SwiftUI
struct SettingsView: View { struct MacAccountView: View {
@ObservedObject var preferences: PreferencesModel @ObservedObject var preferences: PreferencesModel
@ObservedObject var account: AccountModel @ObservedObject var account: AccountModel
@ -33,12 +33,12 @@ struct SettingsView: View {
struct SettingsView_AccountTabPreviews: PreviewProvider { struct SettingsView_AccountTabPreviews: PreviewProvider {
static var previews: some View { static var previews: some View {
SettingsView(preferences: PreferencesModel(), account: AccountModel(), selectedView: 0) MacAccountView(preferences: PreferencesModel(), account: AccountModel(), selectedView: 0)
} }
} }
struct SettingsView_PreferencesTabPreviews: PreviewProvider { struct SettingsView_PreferencesTabPreviews: PreviewProvider {
static var previews: some View { static var previews: some View {
SettingsView(preferences: PreferencesModel(), account: AccountModel(), selectedView: 1) MacAccountView(preferences: PreferencesModel(), account: AccountModel(), selectedView: 1)
} }
} }