mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-05-04 22:44:28 +02:00
Minimum changes for Xcode 11 beta 5
This commit is contained in:
@@ -15,7 +15,7 @@ struct ProfileEditor: View {
|
||||
HStack {
|
||||
Text("Username").bold()
|
||||
Divider()
|
||||
TextField($profile.username)
|
||||
TextField("", text: $profile.username)
|
||||
}
|
||||
|
||||
Toggle(isOn: $profile.prefersNotifications) {
|
||||
@@ -25,20 +25,19 @@ struct ProfileEditor: View {
|
||||
VStack(alignment: .leading, spacing: 20) {
|
||||
Text("Seasonal Photo").bold()
|
||||
|
||||
SegmentedControl(selection: $profile.seasonalPhoto) {
|
||||
ForEach(Profile.Season.allCases.identified(by: \.self)) { season in
|
||||
Picker("", selection: $profile.seasonalPhoto) {
|
||||
ForEach(Profile.Season.allCases, id: \.self) { season in
|
||||
Text(season.rawValue).tag(season)
|
||||
}
|
||||
}
|
||||
}.pickerStyle(SegmentedPickerStyle())
|
||||
}
|
||||
.padding(.top)
|
||||
|
||||
VStack(alignment: .leading, spacing: 20) {
|
||||
Text("Goal Date").bold()
|
||||
DatePicker(
|
||||
$profile.goalDate,
|
||||
minimumDate: Calendar.current.date(byAdding: .year, value: -1, to: profile.goalDate),
|
||||
maximumDate: Calendar.current.date(byAdding: .year, value: 1, to: profile.goalDate),
|
||||
"", selection: $profile.goalDate,
|
||||
in: Calendar.current.date(byAdding: .year, value: -1, to: profile.goalDate)! ... Calendar.current.date(byAdding: .year, value: 1, to: profile.goalDate)!,
|
||||
displayedComponents: .date
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ struct ProfileHost: View {
|
||||
HStack {
|
||||
if self.mode?.value == .active {
|
||||
Button(action: {
|
||||
self.profile = self.draftProfile
|
||||
self.draftProfile = self.profile
|
||||
self.mode?.animation().value = .inactive
|
||||
}) {
|
||||
Text("Done")
|
||||
@@ -33,7 +33,7 @@ struct ProfileHost: View {
|
||||
} else {
|
||||
ProfileEditor(profile: $draftProfile)
|
||||
.onDisappear {
|
||||
self.draftProfile = self.profile
|
||||
self.profile = self.draftProfile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ struct ProfileSummary: View {
|
||||
.bold()
|
||||
.font(.title)
|
||||
|
||||
Text("Notifications: \(self.profile.prefersNotifications ? "On": "Off" )")
|
||||
Text("Notifications: \(self.profile.prefersNotifications ? "Onn": "Off" )")
|
||||
|
||||
Text("Seasonal Photos: \(self.profile.seasonalPhoto.rawValue)")
|
||||
|
||||
@@ -37,7 +37,7 @@ struct ProfileSummary: View {
|
||||
|
||||
HikeBadge(name: "Earth Day")
|
||||
.hueRotation(Angle(degrees: 90))
|
||||
|
||||
|
||||
HikeBadge(name: "Tenth Hike")
|
||||
.grayscale(0.5)
|
||||
.hueRotation(Angle(degrees: 45))
|
||||
|
||||
Reference in New Issue
Block a user