Skip to content

Commit

Permalink
Merge pull request #11 from spacenation/styles
Browse files Browse the repository at this point in the history
Datatype Styles
  • Loading branch information
ay42 committed Mar 13, 2020
2 parents 85ba689 + 36d2874 commit 3d89afb
Show file tree
Hide file tree
Showing 63 changed files with 1,786 additions and 2,013 deletions.
9 changes: 8 additions & 1 deletion Examples/SlidersExamples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
FA815112234ABFC100E3AFA3 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA815110234ABFC100E3AFA3 /* Model.swift */; };
FAA6C40423529AD5002C8FCD /* PointSliderExamplesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA6C40323529AD5002C8FCD /* PointSliderExamplesView.swift */; };
FAA6C40523529AD5002C8FCD /* PointSliderExamplesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA6C40323529AD5002C8FCD /* PointSliderExamplesView.swift */; };
FAAA2FCB241B7A44007021F7 /* Sliders in Frameworks */ = {isa = PBXBuildFile; productRef = FAAA2FCA241B7A44007021F7 /* Sliders */; };
FAF1C03722ED3B7D00F92FEA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF1C03622ED3B7D00F92FEA /* AppDelegate.swift */; };
FAF1C03922ED3B7D00F92FEA /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF1C03822ED3B7D00F92FEA /* SceneDelegate.swift */; };
FAF1C03B22ED3B7D00F92FEA /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF1C03A22ED3B7D00F92FEA /* ContentView.swift */; };
Expand Down Expand Up @@ -62,6 +63,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FAAA2FCB241B7A44007021F7 /* Sliders in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -81,9 +83,9 @@
children = (
FA0D8A35231E221300434037 /* HorizontalSliderExamplesView.swift */,
FA0D8A38231E231D00434037 /* VerticalSliderExamplesView.swift */,
FAA6C40323529AD5002C8FCD /* PointSliderExamplesView.swift */,
FA5592552319EDD700FD07E2 /* HalfCapsule.swift */,
FA815110234ABFC100E3AFA3 /* Model.swift */,
FAA6C40323529AD5002C8FCD /* PointSliderExamplesView.swift */,
);
path = SlidersExamples;
sourceTree = "<group>";
Expand Down Expand Up @@ -178,6 +180,7 @@
);
name = "SlidersExamples macOS";
packageProductDependencies = (
FAAA2FCA241B7A44007021F7 /* Sliders */,
);
productName = "RangeSliderExamples macOS";
productReference = FA61E9B3231365E3006A5B6B /* SlidersExamples macOS.app */;
Expand Down Expand Up @@ -731,6 +734,10 @@
package = FA493846241A13F700830AB0 /* XCRemoteSwiftPackageReference "swiftui-sliders" */;
productName = Sliders;
};
FAAA2FCA241B7A44007021F7 /* Sliders */ = {
isa = XCSwiftPackageProductDependency;
productName = Sliders;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = FAF1C02822ED3AD500F92FEA /* Project object */;
Expand Down
296 changes: 111 additions & 185 deletions Examples/SlidersExamples/HorizontalSliderExamplesView.swift

Large diffs are not rendered by default.

121 changes: 39 additions & 82 deletions Examples/SlidersExamples/PointSliderExamplesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,94 +6,51 @@ struct PointSliderExamplesView: View {

var body: some View {
ScrollView {
Group {
XYSlider(
x: $model.pointX1,
y: $model.pointY1,
track:
ZStack {
LinearGradient(gradient: Gradient(colors: [.red, .orange, .yellow, .green, .blue, .purple, .pink]), startPoint: .leading, endPoint: .trailing)
LinearGradient(gradient: Gradient(colors: [.white, .clear]), startPoint: .bottom, endPoint: .top).blendMode(.hardLight)
},
thumb:
Circle()
.foregroundColor(.white)
.shadow(radius: 3),
configuration: .init(
options: .interactiveTrack,
thumbSize: CGSize(width: 48, height: 48)
)
)
.overlay(
RoundedRectangle(cornerRadius: 24)
.strokeBorder(lineWidth: 4)
.foregroundColor(Color.white)
)
.cornerRadius(24)
.frame(height: 256)
.shadow(radius: 3)
.padding()

HStack {
XYSlider(
x: $model.pointX2,
y: $model.pointY2,
track:
RoundedRectangle(cornerRadius: 24)
.foregroundColor(
Color(hue: 0.67, saturation: model.pointY2, brightness: 1.0)
),
thumb:
ZStack {
Capsule().frame(width: 12).foregroundColor(.white)
Capsule().frame(height: 12).foregroundColor(.white)
}
.compositingGroup()
.rotationEffect(Angle(radians: model.pointX2 * 10))
.shadow(radius: 3),
configuration: .init(
options: .interactiveTrack,
VStack(spacing: 32) {
PointSlider(x: $model.pointX1, y: $model.pointY1)
.frame(height: 256)
.pointSliderStyle(
RectangularPointSliderStyle(
track:
ZStack {
LinearGradient(gradient: Gradient(colors: [.red, .orange, .yellow, .green, .blue, .purple, .pink]), startPoint: .leading, endPoint: .trailing)
LinearGradient(gradient: Gradient(colors: [.white, .clear]), startPoint: .bottom, endPoint: .top).blendMode(.hardLight)
}
.overlay(
RoundedRectangle(cornerRadius: 24)
.strokeBorder(lineWidth: 4)
.foregroundColor(Color.white)
)
.cornerRadius(24),
thumbSize: CGSize(width: 48, height: 48)
)
)

PointSlider(x: $model.pointX2,y: $model.pointY2)
.frame(height: 256)
.shadow(radius: 3)
.padding()

XYSlider(
x: $model.pointX3,
y: $model.pointY3,
track:
ZStack {
LinearGradient(gradient: Gradient(colors: [.blue, .red]), startPoint: .leading, endPoint: .trailing)
VStack {
Text("Any View")
.font(.largeTitle)
.foregroundColor(Color.white)
Text("Place any view here")
.font(.title)
.foregroundColor(Color.white.opacity(0.5))
}
}
.cornerRadius(24),
thumb:
Capsule()
.foregroundColor(.white)
.shadow(radius: 3),
configuration: .init(
options: .interactiveTrack,
thumbSize: CGSize(width: 96, height: 48)
.pointSliderStyle(
RectangularPointSliderStyle(
track:
ZStack {
LinearGradient(gradient: Gradient(colors: [.blue, .red]), startPoint: .leading, endPoint: .trailing)
VStack {
Text("Any View")
.font(.largeTitle)
.foregroundColor(Color.white)
Text("Place any view here")
.font(.title)
.foregroundColor(Color.white.opacity(0.5))
}
}
.cornerRadius(24),
thumb:
Capsule()
.foregroundColor(.white)
.shadow(radius: 3),
thumbSize: CGSize(width: 96, height: 48),
options: .interactiveTrack
)
)
.frame(height: 256)
.shadow(radius: 3)
.padding()
}

XYSlider(x: $model.pointX4, y: $model.pointY4)
.frame(height: 256)
.padding()

}

}
Expand Down
Loading

0 comments on commit 3d89afb

Please sign in to comment.