-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes issue where draggesture would interfere with pickerwheel (#57)
- Loading branch information
Showing
5 changed files
with
141 additions
and
3 deletions.
There are no files selected for viewing
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
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
59 changes: 59 additions & 0 deletions
59
Example/PartialSheetExample/Examples/DatePickerExample.swift
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// DatePickerExample.swift | ||
// PartialSheetExample | ||
// | ||
// Created by Rasmus Styrk on 14/08/2020. | ||
// Copyright © 2020 Swift. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct DatePickerExample: View { | ||
|
||
@EnvironmentObject var partialSheetManager : PartialSheetManager | ||
|
||
var body: some View { | ||
HStack { | ||
Spacer() | ||
Button(action: { | ||
self.partialSheetManager.showPartialSheet({ | ||
print("DatePickerExample sheet dismissed") | ||
}) { | ||
DatePickerSheetView() | ||
} | ||
}, label: { | ||
Text("Display the DatePickerExample Sheet") | ||
}) | ||
.padding() | ||
Spacer() | ||
} | ||
.navigationBarTitle("DatePickerExample Example") | ||
.navigationViewStyle(StackNavigationViewStyle()) | ||
} | ||
} | ||
|
||
struct DatePickerExample_Previews: PreviewProvider { | ||
static var previews: some View { | ||
NavigationView { | ||
DatePickerSheetView() | ||
} | ||
.addPartialSheet() | ||
.navigationViewStyle(StackNavigationViewStyle()) | ||
.environmentObject(PartialSheetManager()) | ||
} | ||
} | ||
|
||
struct DatePickerSheetView: View { | ||
@State private var date: Date = Date() | ||
|
||
var body: some View { | ||
VStack { | ||
VStack { | ||
Text("Settings Panel").font(.headline) | ||
DatePicker("Date", selection: $date) | ||
} | ||
.padding() | ||
.frame(height: 270) | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// | ||
// PickerExample.swift | ||
// PartialSheetExample | ||
// | ||
// Created by Rasmus Styrk on 14/08/2020. | ||
// Copyright © 2020 Swift. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct PickerExample: View { | ||
|
||
@EnvironmentObject var partialSheetManager : PartialSheetManager | ||
|
||
var body: some View { | ||
HStack { | ||
Spacer() | ||
Button(action: { | ||
self.partialSheetManager.showPartialSheet({ | ||
print("PickerExample sheet dismissed") | ||
}) { | ||
PickerSheetView() | ||
} | ||
}, label: { | ||
Text("Display the PickerExample Sheet") | ||
}) | ||
.padding() | ||
Spacer() | ||
} | ||
.navigationBarTitle("PickerExample Example") | ||
.navigationViewStyle(StackNavigationViewStyle()) | ||
} | ||
} | ||
|
||
struct PickerExample_Previews: PreviewProvider { | ||
static var previews: some View { | ||
NavigationView { | ||
PickerSheetView() | ||
} | ||
.addPartialSheet() | ||
.navigationViewStyle(StackNavigationViewStyle()) | ||
.environmentObject(PartialSheetManager()) | ||
} | ||
} | ||
|
||
struct PickerSheetView: View { | ||
var strengths = ["Mild", "Medium", "Mature"] | ||
@State private var selectedStrength = 0 | ||
|
||
var body: some View { | ||
VStack { | ||
VStack { | ||
Text("Settings Panel").font(.headline) | ||
Picker(selection: $selectedStrength, label: EmptyView()) { | ||
ForEach(0 ..< strengths.count) { | ||
Text(self.strengths[$0]) | ||
} | ||
} | ||
} | ||
.padding() | ||
.frame(height: 250) | ||
} | ||
} | ||
} |
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