-
-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// SwiftUIView.swift | ||
// PopTip Demo | ||
// | ||
// Created by Ernesto Rivera on 11/13/19. | ||
// Copyright © 2017 Andrea Mazzini. All rights reserved. | ||
// | ||
|
||
#if canImport(SwiftUI) && canImport(Combine) | ||
import SwiftUI | ||
|
||
@available(iOS 13.0, *) | ||
struct SwiftUIView: View { | ||
|
||
var items = [Item(string: "First"), | ||
Item(string: "Second"), | ||
Item(string: "Third"), | ||
Item(string: "Fourth"), | ||
Item(string: "Fifth")] | ||
|
||
var body: some View { | ||
ScrollView { | ||
Text("Custom SwiftUI view") | ||
ForEach(items) { item in | ||
HStack { | ||
Image(systemName: "person.circle") | ||
Text(item.string) | ||
Spacer() | ||
} | ||
.foregroundColor(.secondary) | ||
} | ||
} | ||
} | ||
} | ||
|
||
class Item: Identifiable { | ||
let id = UUID() | ||
|
||
var string: String | ||
|
||
init(string: String) { | ||
self.string = string | ||
} | ||
} | ||
|
||
@available(iOS 13.0, *) | ||
struct SwiftUIView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
SwiftUIView() | ||
} | ||
} | ||
#endif |