commit fb7787583efd31d4c09176b0d6a509c771002a98
parent 24cb346d0f1bc48999585e5b63d6d492a8ee1cd8
Author: therealFIGBERT <figbertwelner@gmail.com>
Date: Fri, 8 Nov 2019 23:45:48 -0800
Fixing json file numbering glitch, removing expandable forEach error
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/AudioRecorder.swift b/AudioRecorder.swift
@@ -101,6 +101,9 @@ class AudioRecorder: NSObject, ObservableObject {
}
}
recordings.sort(by: { $0.createdAt.compare($1.createdAt) == .orderedAscending})
+ for (index, _) in recordings.enumerated() {
+ recordings[index].number = index + 1
+ }
}
func deleteRecording(urlsToDelete: [URL]) {
@@ -203,5 +206,5 @@ struct Recording: Codable {
let fileURL: URL
let createdAt: Date
let title: String
- let number: Int
+ var number: Int
}
diff --git a/Settings.swift b/Settings.swift
@@ -27,12 +27,12 @@ struct Settings: View {
}
Section(header: Text("Prompt")) {
Picker("Date format", selection: $globalVars.currentDateFormat) {
- ForEach(0 ..< globalVars.dateFormats.count) {
+ ForEach(0 ..< globalVars.dateFormats.count, id: \.self) {
Text("\(self.globalVars.dateFormats[$0])")
}
}
Picker("Intro message", selection: $globalVars.currentMessage) {
- ForEach(0 ..< globalVars.messages.count) {
+ ForEach(0 ..< globalVars.messages.count, id: \.self) {
Text("\(self.globalVars.messages[$0])")
}
}