91 lines
4.0 KiB
Swift
91 lines
4.0 KiB
Swift
|
|
extension Post {
|
|
|
|
enum Mock {
|
|
|
|
static func mockData(content: Content) -> [Post] {
|
|
[
|
|
Post(content: content,
|
|
id: "empty",
|
|
isDraft: true,
|
|
createdDate: .now,
|
|
startDate: .now,
|
|
endDate: nil,
|
|
tags: [],
|
|
german: .init(
|
|
content: content,
|
|
text: "Text"),
|
|
english: .init(
|
|
content: content,
|
|
text: "Text"),
|
|
linkedPage: nil),
|
|
Post(
|
|
content: content,
|
|
id: "hike",
|
|
isDraft: false,
|
|
createdDate: .now,
|
|
startDate: .now,
|
|
endDate: nil,
|
|
tags: [
|
|
content.tags.first(where: { $0.id == "nature" })!,
|
|
content.tags.first(where: { $0.id == "sports" })!,
|
|
content.tags.first(where: { $0.id == "hiking" })!
|
|
],
|
|
german: .init(
|
|
content: content,
|
|
title: "Eine Wanderung",
|
|
text: "Sehr schöne und einsame Tour von Oberau zum Krottenkopf. Abwechslungsreich und stellenweise fordernd, aufgrund der Länge und der Höhenmeter auch anstrengend."),
|
|
english: .init(
|
|
content: content,
|
|
title: "A hike",
|
|
text: "Very nice and solitary hike from Oberau to Krottenkopf. Challenging and rewarding, due to the length and height")
|
|
),
|
|
Post(
|
|
content: content,
|
|
id: "hike2",
|
|
isDraft: true,
|
|
createdDate: .now,
|
|
startDate: .now.addingTimeInterval(-86400), endDate: .now,
|
|
tags: [
|
|
content.tags.first(where: { $0.id == "nature" })!,
|
|
content.tags.first(where: { $0.id == "sports" })!,
|
|
content.tags.first(where: { $0.id == "hiking" })!,
|
|
content.tags.first(where: { $0.id == "mountains" })!
|
|
],
|
|
german: LocalizedPost(
|
|
content: content,
|
|
title: "Eine lange Wanderung",
|
|
text: "Sehr schöne und einsame Tour von Oberau zum Krottenkopf. Abwechslungsreich und stellenweise fordernd, aufgrund der Länge und der Höhenmeter auch anstrengend.",
|
|
images: [
|
|
content.files.first(where: { $0.id == "image1" })!,
|
|
content.files.first(where: { $0.id == "image2" })!,
|
|
content.files.first(where: { $0.id == "image3" })!,
|
|
content.files.first(where: { $0.id == "image4" })!
|
|
]),
|
|
english: LocalizedPost(
|
|
content: content,
|
|
title: "A longer hike",
|
|
text: "Very nice and solitary hike from Oberau to Krottenkopf. Challenging and rewarding, due to the length and height.",
|
|
images: [
|
|
content.files.first(where: { $0.id == "image1" })!,
|
|
content.files.first(where: { $0.id == "image2" })!,
|
|
content.files.first(where: { $0.id == "image3" })!,
|
|
content.files.first(where: { $0.id == "image4" })!
|
|
]))
|
|
]
|
|
}
|
|
|
|
static var empty: Post {
|
|
Content.mock.posts.first(where: { $0.id == "empty" })!
|
|
}
|
|
|
|
static var hike: Post {
|
|
Content.mock.posts.first(where: { $0.id == "hike" })!
|
|
}
|
|
|
|
static var hike2: Post {
|
|
Content.mock.posts.first(where: { $0.id == "hike2" })!
|
|
}
|
|
}
|
|
}
|