Source code for the WriteFreely SwiftUI app for iOS, iPadOS, and macOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

54 line
2.0 KiB

  1. import Foundation
  2. import WriteFreely
  3. struct Post: Identifiable {
  4. var id = UUID()
  5. var title: String
  6. var body: String
  7. var createdDate: Date
  8. var status: PostStatus = .draft
  9. var editableText: String {
  10. return """
  11. # \(self.title)
  12. \(self.body)
  13. """
  14. }
  15. }
  16. let testPost = Post(
  17. title: "Test Post Title",
  18. body: """
  19. Here's some cool sample body text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ultrices \
  20. posuere dignissim. Vestibulum a libero tempor, lacinia nulla vitae, congue purus. Nunc ac nulla quam. Duis \
  21. tincidunt eros augue, et volutpat tortor pulvinar ut. Nullam sit amet maximus urna. Phasellus non dignissim lacus.\
  22. Nulla ac posuere ex. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec \
  23. non molestie mauris. Suspendisse potenti. Vivamus at erat turpis.
  24. Pellentesque porttitor gravida tincidunt. Sed vitae eros non metus aliquam hendrerit. Aliquam sed risus suscipit \
  25. turpis dictum dictum. Duis lacus lectus, dictum vel felis in, rhoncus fringilla felis. Nunc id dolor nisl. Aliquam \
  26. euismod purus elit. Nullam egestas neque leo, sed aliquet ligula ultrices nec.
  27. """,
  28. createdDate: Date(),
  29. status: .published)
  30. let testPostData = [
  31. Post(
  32. title: "My First Post",
  33. body: "Look at me, creating a first post! That's cool.",
  34. createdDate: Date(timeIntervalSince1970: 1595429452),
  35. status: .published
  36. ),
  37. Post(
  38. title: "Post 2: The Quickening",
  39. body: "See, here's the rule about Highlander jokes: _there can be only one_.",
  40. createdDate: Date(timeIntervalSince1970: 1595514125),
  41. status: .edited
  42. ),
  43. Post(
  44. title: "The Post Revolutions",
  45. body: "I can never keep the Matrix movie order straight. Why not just call them part 2 and part 3?",
  46. createdDate: Date(timeIntervalSince1970: 1595600006)
  47. )
  48. ]