Skip to content
This repository was archived by the owner on Apr 1, 2024. It is now read-only.

Commit ad76a5e

Browse files
committed
Added Code Comments To iOS Settings View File
1 parent e803117 commit ad76a5e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Source Code/Note.it/Note.it iOS/SettingsView.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,30 @@ import CodeMirror_SwiftUI
1010
import MessageUI
1111

1212
struct SettingsView: View {
13+
//Setup Mail Sheet View And Result Trackers
1314
@State var result: Result<MFMailComposeResult, Error>? = nil
1415
@State var isShowingMailView = false
1516
var body: some View {
17+
//Show Settings Sections In A Form
1618
Form {
1719
EditorSettings()
1820
ThemesSettings()
1921
misc
2022
}
2123
.navigationTitle("Settings")
2224
}
25+
//Misc Settings Section
2326
var misc: some View {
2427
Section {
28+
//Version Text
2529
LabeledContent("Version", value: "2.0")
30+
//Build Text
2631
LabeledContent("Build", value: "5")
32+
//Button To Send Feedback
2733
Button(action: {isShowingMailView.toggle()}) {
2834
Text("Send Feedback")
2935
}
36+
//Feedback Mail View Sheet
3037
.sheet(isPresented: $isShowingMailView) {
3138
MailView(isShowing: self.$isShowingMailView, result: self.$result)
3239
}
@@ -43,14 +50,17 @@ struct SettingsView_Previews: PreviewProvider {
4350
}
4451

4552
struct ThemesSettings: View {
53+
//Store Editor Syntax And Theme Selection
4654
@AppStorage("selectedSyntax") var selectedSyntax = 51
4755
@AppStorage("selectedTheme") var selectedTheme = 80
4856
@AppStorage("syntax") var syntax: CodeMode = CodeMode.text
4957
@AppStorage("theme") var theme: CodeViewTheme = CodeViewTheme.zenburnesque
5058
var body: some View {
59+
//Example Code Editor View
5160
Section {
5261
CodeView(theme: theme, code: .constant("Hello World"), mode: syntax.mode(), fontSize: 12, showInvisibleCharacters: false, lineWrapping: false)
5362
}
63+
//Theme Picker
5464
Section {
5565
Picker(selection: $selectedTheme, label: Text("Theme")) {
5666
Group {
@@ -507,6 +517,7 @@ struct ThemesSettings: View {
507517
}
508518
}
509519
.pickerStyle(.menu)
520+
//Detect Changes In The Theme Picker
510521
.onChange(of: selectedTheme) { themeValue in
511522
if themeValue == 1 {
512523
self.theme = CodeViewTheme.bbedit
@@ -830,6 +841,7 @@ struct ThemesSettings: View {
830841
self.theme = CodeViewTheme.irWhite
831842
}
832843
}
844+
//Syntax Picker
833845
Picker(selection: $selectedSyntax, label: Text("Syntax")) {
834846
Group {
835847
Button(action: {}) {
@@ -1085,6 +1097,7 @@ struct ThemesSettings: View {
10851097
}
10861098
}
10871099
.pickerStyle(.menu)
1100+
//Detect Changes In The Syntax Picker
10881101
.onChange(of: selectedSyntax) { syntax in
10891102
if syntax == 1 {
10901103
self.syntax = CodeMode.apl
@@ -1274,16 +1287,20 @@ struct ThemesSettings: View {
12741287
}
12751288

12761289
struct EditorSettings: View {
1290+
//Store Editor Settings
12771291
@AppStorage("lineWrapping") var lineWrapping = true
12781292
@AppStorage("showInvisibleCharacters") var showInvisibleCharacters = false
12791293
@AppStorage("fontSize") var fontSize = 12
12801294
var body: some View {
12811295
Section {
1296+
//Font Size Stepper
12821297
Stepper("Font Size - \(fontSize)", value: $fontSize, in: 1...120)
1298+
//Toggle Line Wrapping
12831299
Toggle(isOn: $lineWrapping) {
12841300
Text("Line Wrapping")
12851301
}
12861302
.toggleStyle(.switch)
1303+
//Toggle Showing Invisible Characters
12871304
Toggle(isOn: $showInvisibleCharacters) {
12881305
Text("Show Invisible Characters")
12891306
}
@@ -1294,6 +1311,7 @@ struct EditorSettings: View {
12941311
}
12951312
}
12961313

1314+
//Create Mail View To Send Feedback
12971315
struct MailView: UIViewControllerRepresentable {
12981316
@Binding var isShowing: Bool
12991317
@Binding var result: Result<MFMailComposeResult, Error>?

0 commit comments

Comments
 (0)