WIP
This commit is contained in:
@@ -74,4 +74,34 @@ class PreviewWorkout {
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
|
||||
class func parseRegisterdUser() -> RegisteredUser {
|
||||
if let filepath = Bundle.main.path(forResource: "RegisteredUser", ofType: "json") {
|
||||
do {
|
||||
let data = try Data(NSData(contentsOfFile: filepath))
|
||||
let muscles = try JSONDecoder().decode(RegisteredUser.self, from: data)
|
||||
return muscles
|
||||
} catch {
|
||||
print(error)
|
||||
fatalError()
|
||||
}
|
||||
} else {
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
|
||||
class func parseCompletedWorkouts() -> [CompletedWorkout] {
|
||||
if let filepath = Bundle.main.path(forResource: "CompletedWorkouts", ofType: "json") {
|
||||
do {
|
||||
let data = try Data(NSData(contentsOfFile: filepath))
|
||||
let muscles = try JSONDecoder().decode([CompletedWorkout].self, from: data)
|
||||
return muscles
|
||||
} catch {
|
||||
print(error)
|
||||
fatalError()
|
||||
}
|
||||
} else {
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user