This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let url: URL | |
let metadataProvider: LPMetadataProvider = .init() | |
metadataProvider.startFetchingMetadata(for: url) { metadata, error in | |
if let error = error { | |
print(error) | |
return | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var body: some View { | |
ViewThatFits { | |
Text("Hello, I am the longer text and most probably I will be visible only in the landscape mode") | |
.frame(width: 700, height: 300) | |
Text("Hello, I am the shorter text") | |
.frame(width: 300, height: 100) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let chartData: [KeyValue] = [ | |
.init(key: "A", value: 5), | |
.init(key: "B", value: 10), | |
.init(key: "C", value: 15) | |
] | |
var body: some View { | |
Chart(chartData) { | |
BarMark(x: .value("Key", $0.key), | |
y: .value("Value", $0.value)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@State var changeLayout: Bool = false | |
var body: some View { | |
let layout = changeLayout ? AnyLayout(HStack()) : AnyLayout(VStack()) | |
VStack { | |
layout { | |
Text("First") | |
Text("Second") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var body: some View { | |
VStack { | |
VStack { | |
Image(systemName: "person") | |
} | |
.background(in: Circle().inset(by: -20)) | |
.backgroundStyle(.orange.gradient) | |
.foregroundStyle(.white.shadow(.drop(radius: 1))) | |
VStack { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@State var selectedPhotos: [PhotosPickerItem] = [] | |
var body: some View { | |
PhotosPicker(selection: $selectedPhotos) { | |
Text("Choose photos") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@State var profileNotificationsIsOn: Bool = false | |
@State var campaignNotificationsIsOn: Bool = false | |
@State var emailNotificationsIsOn: Bool = false | |
var body: some View { | |
DisclosureGroup { | |
Toggle("Profile Notifications", isOn: $profileNotificationsIsOn) | |
Toggle("Campaign Notifications", isOn: $campaignNotificationsIsOn) | |
Toggle("E-Mail Notifications", isOn: $emailNotificationsIsOn) | |
} label: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@State var selectedDates: Set<DateComponents> = [] | |
var body: some View { | |
MultiDatePicker("Dates", selection: $selectedDates) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@State var textFieldText: String = "" | |
var body: some View { | |
TextField("I am just a text field", text: $textFieldText, axis: .vertical) | |
.lineLimit(...2) | |
} |
NewerOlder