LazyView.swift 679 B

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // LazyView.swift
  3. // ark_ui_basic
  4. //
  5. // Audited for 6.5.4
  6. // Status: Complete
  7. // MARK: - ParameterizedLazyView
  8. struct ParameterizedLazyView<Value, Content>: View where Content: View {
  9. var value: Value
  10. var content: (Value) -> Content
  11. init(value: Value, content: @escaping (Value) -> Content) {
  12. self.value = value
  13. self.content = content
  14. }
  15. var body: some View {
  16. content(value)
  17. }
  18. }
  19. // MARK: - LazyView
  20. struct LazyView<Content>: View where Content: View {
  21. var content: () -> Content
  22. init(content: @escaping () -> Content) {
  23. self.content = content
  24. }
  25. var body: some View {
  26. content()
  27. }
  28. }