I'm trying to figure out why I keep getting the following error using SwiftUI:
Cannot use instance member 'selectedWateredDate' within property initializer; property initializers run before 'self' is available
for my "dateInterval" variable.
@State private var selectedWateredDate = Date()
@State private var waterMeAgainIn: Date = Date().addingTimeInterval(7 * 86400)
let dateInterval = DateInterval(start: selectedWateredDate, end: waterMeAgainIn)
Change the let property to a computed variable.
var dateInterval : DateInterval { DateInterval(start: selectedWateredDate, end: waterMeAgainIn)}