// // PlaceholderController.swift // ComposeUI // // Created by Shadowfacts on 3/6/23. // import SwiftUI final class PlaceholderController: ViewController, PlaceholderViewProvider { private let placeholderView: PlaceholderView = PlaceholderController.makePlaceholderView() static func makePlaceholderView() -> some View { let components = Calendar.current.dateComponents([.month, .day], from: Date()) if components.month == 3 && components.day == 14, Date().formatted(date: .numeric, time: .omitted).starts(with: "3") { Text("Happy π day!") } else if components.month == 4 && components.day == 1 { Text("April Fool's!").rotationEffect(.radians(.pi), anchor: .center) } else if components.month == 9 && components.day == 5 { // https://weirder.earth/@noracodes/109276419847254552 // https://retrocomputing.stackexchange.com/questions/14763/what-warning-was-given-on-attempting-to-post-to-usenet-circa-1990 Text("This program posts news to thousands of machines throughout the entire populated world. Please be sure you know what you are doing.").italic() } else if components.month == 9 && components.day == 21 { Text("Do you remember?") } else if components.month == 10 && components.day == 31 { if .random() { Text("Post something spooky!") } else { Text("Any questions?") } } else { Text("What's on your mind?") } } var view: some View { placeholderView } } // exists to provide access to the type alias since the @State property needs it to be explicit private protocol PlaceholderViewProvider { associatedtype PlaceholderView: View @ViewBuilder static func makePlaceholderView() -> PlaceholderView }