Having some trouble with my code. So I have these HealthKit Objects I'm trying to return to be displayed as widgets later on in my code.
import Foundation
struct Activity: Identifiable {
var id: String
var name: String
var image: String
static func allActivities() -> [Activity] {
return[Activity(id:"bloodAlcoholContent", name:"BAC: ", image: "🩸🍷")]
return[Activity(id:"heartRate", name:"Heart Rate: ", image: "❤️ ")]
return[Activity(id:"oxygenSaturation", name:"Blood Oxygen: ", image: "🩸")]
return[Activity(id:"respiratoryRate", name:"Respiratory Rate: ", image: "🫁")]
return[Activity(id:"numberOfAlcoholicBeverages", name:"Units Consumed: ", image: "🍷")]
}
}
Xcode has warned me that this return value won't process code after it and upon building the app I can see what it meant after building the project. Only the first return value is given so only the BAC Widget is displayed. And the rest are not.
Any idea how I can do multiple returns?
[Activity(...), Activity(...), Activity(...), Activity(...), ...]and so on.