Skip to content

Commit 3d89afb

Browse files
authored
Merge pull request #11 from spacenation/styles
Datatype Styles
2 parents 85ba689 + 36d2874 commit 3d89afb

File tree

63 files changed

+1786
-2013
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1786
-2013
lines changed

Examples/SlidersExamples.xcodeproj/project.pbxproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
FA815112234ABFC100E3AFA3 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA815110234ABFC100E3AFA3 /* Model.swift */; };
2424
FAA6C40423529AD5002C8FCD /* PointSliderExamplesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA6C40323529AD5002C8FCD /* PointSliderExamplesView.swift */; };
2525
FAA6C40523529AD5002C8FCD /* PointSliderExamplesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA6C40323529AD5002C8FCD /* PointSliderExamplesView.swift */; };
26+
FAAA2FCB241B7A44007021F7 /* Sliders in Frameworks */ = {isa = PBXBuildFile; productRef = FAAA2FCA241B7A44007021F7 /* Sliders */; };
2627
FAF1C03722ED3B7D00F92FEA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF1C03622ED3B7D00F92FEA /* AppDelegate.swift */; };
2728
FAF1C03922ED3B7D00F92FEA /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF1C03822ED3B7D00F92FEA /* SceneDelegate.swift */; };
2829
FAF1C03B22ED3B7D00F92FEA /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF1C03A22ED3B7D00F92FEA /* ContentView.swift */; };
@@ -62,6 +63,7 @@
6263
isa = PBXFrameworksBuildPhase;
6364
buildActionMask = 2147483647;
6465
files = (
66+
FAAA2FCB241B7A44007021F7 /* Sliders in Frameworks */,
6567
);
6668
runOnlyForDeploymentPostprocessing = 0;
6769
};
@@ -81,9 +83,9 @@
8183
children = (
8284
FA0D8A35231E221300434037 /* HorizontalSliderExamplesView.swift */,
8385
FA0D8A38231E231D00434037 /* VerticalSliderExamplesView.swift */,
86+
FAA6C40323529AD5002C8FCD /* PointSliderExamplesView.swift */,
8487
FA5592552319EDD700FD07E2 /* HalfCapsule.swift */,
8588
FA815110234ABFC100E3AFA3 /* Model.swift */,
86-
FAA6C40323529AD5002C8FCD /* PointSliderExamplesView.swift */,
8789
);
8890
path = SlidersExamples;
8991
sourceTree = "<group>";
@@ -178,6 +180,7 @@
178180
);
179181
name = "SlidersExamples macOS";
180182
packageProductDependencies = (
183+
FAAA2FCA241B7A44007021F7 /* Sliders */,
181184
);
182185
productName = "RangeSliderExamples macOS";
183186
productReference = FA61E9B3231365E3006A5B6B /* SlidersExamples macOS.app */;
@@ -731,6 +734,10 @@
731734
package = FA493846241A13F700830AB0 /* XCRemoteSwiftPackageReference "swiftui-sliders" */;
732735
productName = Sliders;
733736
};
737+
FAAA2FCA241B7A44007021F7 /* Sliders */ = {
738+
isa = XCSwiftPackageProductDependency;
739+
productName = Sliders;
740+
};
734741
/* End XCSwiftPackageProductDependency section */
735742
};
736743
rootObject = FAF1C02822ED3AD500F92FEA /* Project object */;

Examples/SlidersExamples/HorizontalSliderExamplesView.swift

Lines changed: 111 additions & 185 deletions
Large diffs are not rendered by default.

Examples/SlidersExamples/PointSliderExamplesView.swift

Lines changed: 39 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -6,94 +6,51 @@ struct PointSliderExamplesView: View {
66

77
var body: some View {
88
ScrollView {
9-
Group {
10-
XYSlider(
11-
x: $model.pointX1,
12-
y: $model.pointY1,
13-
track:
14-
ZStack {
15-
LinearGradient(gradient: Gradient(colors: [.red, .orange, .yellow, .green, .blue, .purple, .pink]), startPoint: .leading, endPoint: .trailing)
16-
LinearGradient(gradient: Gradient(colors: [.white, .clear]), startPoint: .bottom, endPoint: .top).blendMode(.hardLight)
17-
},
18-
thumb:
19-
Circle()
20-
.foregroundColor(.white)
21-
.shadow(radius: 3),
22-
configuration: .init(
23-
options: .interactiveTrack,
24-
thumbSize: CGSize(width: 48, height: 48)
25-
)
26-
)
27-
.overlay(
28-
RoundedRectangle(cornerRadius: 24)
29-
.strokeBorder(lineWidth: 4)
30-
.foregroundColor(Color.white)
31-
)
32-
.cornerRadius(24)
33-
.frame(height: 256)
34-
.shadow(radius: 3)
35-
.padding()
36-
37-
HStack {
38-
XYSlider(
39-
x: $model.pointX2,
40-
y: $model.pointY2,
41-
track:
42-
RoundedRectangle(cornerRadius: 24)
43-
.foregroundColor(
44-
Color(hue: 0.67, saturation: model.pointY2, brightness: 1.0)
45-
),
46-
thumb:
47-
ZStack {
48-
Capsule().frame(width: 12).foregroundColor(.white)
49-
Capsule().frame(height: 12).foregroundColor(.white)
50-
}
51-
.compositingGroup()
52-
.rotationEffect(Angle(radians: model.pointX2 * 10))
53-
.shadow(radius: 3),
54-
configuration: .init(
55-
options: .interactiveTrack,
9+
VStack(spacing: 32) {
10+
PointSlider(x: $model.pointX1, y: $model.pointY1)
11+
.frame(height: 256)
12+
.pointSliderStyle(
13+
RectangularPointSliderStyle(
14+
track:
15+
ZStack {
16+
LinearGradient(gradient: Gradient(colors: [.red, .orange, .yellow, .green, .blue, .purple, .pink]), startPoint: .leading, endPoint: .trailing)
17+
LinearGradient(gradient: Gradient(colors: [.white, .clear]), startPoint: .bottom, endPoint: .top).blendMode(.hardLight)
18+
}
19+
.overlay(
20+
RoundedRectangle(cornerRadius: 24)
21+
.strokeBorder(lineWidth: 4)
22+
.foregroundColor(Color.white)
23+
)
24+
.cornerRadius(24),
5625
thumbSize: CGSize(width: 48, height: 48)
5726
)
5827
)
28+
29+
PointSlider(x: $model.pointX2,y: $model.pointY2)
5930
.frame(height: 256)
60-
.shadow(radius: 3)
61-
.padding()
62-
63-
XYSlider(
64-
x: $model.pointX3,
65-
y: $model.pointY3,
66-
track:
67-
ZStack {
68-
LinearGradient(gradient: Gradient(colors: [.blue, .red]), startPoint: .leading, endPoint: .trailing)
69-
VStack {
70-
Text("Any View")
71-
.font(.largeTitle)
72-
.foregroundColor(Color.white)
73-
Text("Place any view here")
74-
.font(.title)
75-
.foregroundColor(Color.white.opacity(0.5))
76-
}
77-
}
78-
.cornerRadius(24),
79-
thumb:
80-
Capsule()
81-
.foregroundColor(.white)
82-
.shadow(radius: 3),
83-
configuration: .init(
84-
options: .interactiveTrack,
85-
thumbSize: CGSize(width: 96, height: 48)
31+
.pointSliderStyle(
32+
RectangularPointSliderStyle(
33+
track:
34+
ZStack {
35+
LinearGradient(gradient: Gradient(colors: [.blue, .red]), startPoint: .leading, endPoint: .trailing)
36+
VStack {
37+
Text("Any View")
38+
.font(.largeTitle)
39+
.foregroundColor(Color.white)
40+
Text("Place any view here")
41+
.font(.title)
42+
.foregroundColor(Color.white.opacity(0.5))
43+
}
44+
}
45+
.cornerRadius(24),
46+
thumb:
47+
Capsule()
48+
.foregroundColor(.white)
49+
.shadow(radius: 3),
50+
thumbSize: CGSize(width: 96, height: 48),
51+
options: .interactiveTrack
8652
)
8753
)
88-
.frame(height: 256)
89-
.shadow(radius: 3)
90-
.padding()
91-
}
92-
93-
XYSlider(x: $model.pointX4, y: $model.pointY4)
94-
.frame(height: 256)
95-
.padding()
96-
9754
}
9855

9956
}

0 commit comments

Comments
 (0)