First version
This commit is contained in:
19
CHDataManagement/Preview Content/MockImage.swift
Normal file
19
CHDataManagement/Preview Content/MockImage.swift
Normal file
@ -0,0 +1,19 @@
|
||||
import SwiftUI
|
||||
|
||||
/// An image loaded from the app resources for test purposes
|
||||
struct MockImage {
|
||||
|
||||
let name: String
|
||||
|
||||
static var images: [ImageResource] {
|
||||
["image1", "image2", "image3", "image4"]
|
||||
.map(ImageResource.init)
|
||||
}
|
||||
}
|
||||
|
||||
extension MockImage: ExpressibleByStringLiteral {
|
||||
|
||||
init(stringLiteral value: StringLiteralType) {
|
||||
self.name = value
|
||||
}
|
||||
}
|
18
CHDataManagement/Preview Content/Page+Mock.swift
Normal file
18
CHDataManagement/Preview Content/Page+Mock.swift
Normal file
@ -0,0 +1,18 @@
|
||||
import Foundation
|
||||
|
||||
extension Page {
|
||||
|
||||
static var empty: Page {
|
||||
.init(
|
||||
id: "my-id",
|
||||
isDraft: true,
|
||||
metadata: [
|
||||
.init(language: .english, headline: "Title"),
|
||||
.init(language: .german, headline: "Titel")
|
||||
],
|
||||
externalFiles: [],
|
||||
requiredFiles: [],
|
||||
images: [])
|
||||
}
|
||||
}
|
||||
|
53
CHDataManagement/Preview Content/Post+Mock.swift
Normal file
53
CHDataManagement/Preview Content/Post+Mock.swift
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
extension Post {
|
||||
|
||||
static var empty: Post {
|
||||
.init(id: 0,
|
||||
isDraft: true,
|
||||
startDate: .now,
|
||||
title: .init(en: "The title", de: "Der Titel"),
|
||||
text: .init(en: "", de: ""),
|
||||
tags: [],
|
||||
images: [])
|
||||
}
|
||||
|
||||
static var mock: Post {
|
||||
Post(
|
||||
id: 1,
|
||||
isDraft: false,
|
||||
startDate: .now,
|
||||
endDate: nil,
|
||||
title: .init(en: "The title", de: "Der Titel"),
|
||||
text: .init(
|
||||
en: "Very nice and solitary hike from Oberau to Krottenkopf. Challenging and rewarding, due to the length and height.",
|
||||
de: "Sehr schöne und einsame Tour von Oberau zum Krottenkopf. Abwechslungsreich und stellenweise fordernd, aufgrund der Länge und der Höhenmeter auch anstrengend."
|
||||
),
|
||||
tags: [
|
||||
Tag(en: "Nature", de: "Natur"),
|
||||
Tag(en: "Sports", de: "Sport"),
|
||||
Tag(en: "Hiking", de: "Wandern")
|
||||
],
|
||||
images: []
|
||||
)
|
||||
}
|
||||
|
||||
static var fullMock: Post {
|
||||
.init(
|
||||
id: 2,
|
||||
isDraft: true,
|
||||
startDate: .now.addingTimeInterval(-86400), endDate: .now,
|
||||
title: .init(en: "A longer title", de: "Ein langer Titel"),
|
||||
text: .init(
|
||||
en: "Very nice and solitary hike from Oberau to Krottenkopf. Challenging and rewarding, due to the length and height.",
|
||||
de: "Sehr schöne und einsame Tour von Oberau zum Krottenkopf. Abwechslungsreich und stellenweise fordernd, aufgrund der Länge und der Höhenmeter auch anstrengend."
|
||||
),
|
||||
tags: [
|
||||
Tag(en: "Nature", de: "Natur"),
|
||||
Tag(en: "Sports", de: "Sport"),
|
||||
Tag(en: "Hiking", de: "Wandern"),
|
||||
Tag(en: "Mountains", de: "Berge")
|
||||
],
|
||||
images: MockImage.images
|
||||
)
|
||||
}
|
||||
}
|
21
CHDataManagement/Preview Content/Preview Assets.xcassets/image1.imageset/Contents.json
vendored
Normal file
21
CHDataManagement/Preview Content/Preview Assets.xcassets/image1.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "image1.jpg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
CHDataManagement/Preview Content/Preview Assets.xcassets/image1.imageset/image1.jpg
vendored
Normal file
BIN
CHDataManagement/Preview Content/Preview Assets.xcassets/image1.imageset/image1.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 MiB |
21
CHDataManagement/Preview Content/Preview Assets.xcassets/image2.imageset/Contents.json
vendored
Normal file
21
CHDataManagement/Preview Content/Preview Assets.xcassets/image2.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "image2.jpg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
CHDataManagement/Preview Content/Preview Assets.xcassets/image2.imageset/image2.jpg
vendored
Normal file
BIN
CHDataManagement/Preview Content/Preview Assets.xcassets/image2.imageset/image2.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 MiB |
21
CHDataManagement/Preview Content/Preview Assets.xcassets/image3.imageset/Contents.json
vendored
Normal file
21
CHDataManagement/Preview Content/Preview Assets.xcassets/image3.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "image3.jpg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
CHDataManagement/Preview Content/Preview Assets.xcassets/image3.imageset/image3.jpg
vendored
Normal file
BIN
CHDataManagement/Preview Content/Preview Assets.xcassets/image3.imageset/image3.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 MiB |
21
CHDataManagement/Preview Content/Preview Assets.xcassets/image4.imageset/Contents.json
vendored
Normal file
21
CHDataManagement/Preview Content/Preview Assets.xcassets/image4.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "image4.jpg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
CHDataManagement/Preview Content/Preview Assets.xcassets/image4.imageset/image4.jpg
vendored
Normal file
BIN
CHDataManagement/Preview Content/Preview Assets.xcassets/image4.imageset/image4.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 MiB |
Reference in New Issue
Block a user