|
|
|
|
@ -38,9 +38,6 @@ struct CountdownEditView : View { |
|
|
|
|
@State var minutesString: String = "" |
|
|
|
|
@State var nameString: String = "" |
|
|
|
|
|
|
|
|
|
@State var playlists: Set<Playlist> = [] |
|
|
|
|
@State var sounds: Set<Sound> = [] |
|
|
|
|
|
|
|
|
|
@State var soundRepeatCount: Int16 = 0 |
|
|
|
|
@State var image: CoolPic = .pic1 |
|
|
|
|
|
|
|
|
|
@ -140,26 +137,6 @@ struct CountdownEditView : View { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// MARK: - Bindings |
|
|
|
|
|
|
|
|
|
func playlistBinding(playlist: Playlist) -> Binding<Bool> { |
|
|
|
|
Binding<Bool>( |
|
|
|
|
get: { self.playlists.contains(playlist) }, |
|
|
|
|
set: { if $0 { self.playlists.insert(playlist) } |
|
|
|
|
else { self.playlists.remove(playlist) } |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func soundBinding(sound: Sound) -> Binding<Bool> { |
|
|
|
|
Binding<Bool>( |
|
|
|
|
get: { self.sounds.contains(sound) }, |
|
|
|
|
set: { if $0 { self.sounds.insert(sound) } |
|
|
|
|
else { self.sounds.remove(sound) } |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// MARK: - Business |
|
|
|
|
|
|
|
|
|
fileprivate func _onAppear() { |
|
|
|
|
@ -170,6 +147,8 @@ struct CountdownEditView : View { |
|
|
|
|
|
|
|
|
|
if let countdown { |
|
|
|
|
|
|
|
|
|
print("self.soundList = \(countdown.soundList)") |
|
|
|
|
|
|
|
|
|
let minutes = Int(countdown.duration / 60.0) |
|
|
|
|
let seconds = countdown.duration - Double(minutes * 60) |
|
|
|
|
|
|
|
|
|
@ -185,7 +164,7 @@ struct CountdownEditView : View { |
|
|
|
|
self.nameString = name |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// self.sounds = countdown.sounds |
|
|
|
|
self.model.sounds = countdown.sounds |
|
|
|
|
|
|
|
|
|
// if let sound = Sound(rawValue: Int(countdown.sound)) { |
|
|
|
|
// self.sound = sound |
|
|
|
|
@ -230,7 +209,8 @@ struct CountdownEditView : View { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cd.image = self.image.rawValue |
|
|
|
|
// cd.setSounds(self.sounds) |
|
|
|
|
cd.setSounds(self.model.sounds) |
|
|
|
|
|
|
|
|
|
// cd.setPlaylists(self.playlists) |
|
|
|
|
cd.repeatCount = self.soundRepeatCount |
|
|
|
|
|
|
|
|
|
|