Skip to content

Commit

Permalink
Merge pull request #12 from spacenation/update
Browse files Browse the repository at this point in the history
Inlinable styles
  • Loading branch information
ay42 committed Mar 26, 2020
2 parents 3d89afb + e5b4e95 commit 135aef3
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 20 deletions.
2 changes: 2 additions & 0 deletions Examples/SlidersExamples macOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSMainStoryboardFile</key>
Expand Down
4 changes: 2 additions & 2 deletions Examples/SlidersExamples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_ASSET_PATHS = "\"SlidersExamples iOS\"/Preview\\ Content";
DEVELOPMENT_TEAM = Z8L4G5WZR3;
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -652,7 +652,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_ASSET_PATHS = "\"SlidersExamples iOS\"/Preview\\ Content";
DEVELOPMENT_TEAM = Z8L4G5WZR3;
DEVELOPMENT_TEAM = "";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_PREVIEWS = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down
6 changes: 3 additions & 3 deletions Sources/Sliders/PointSlider/Style/AnyPointSliderStyle.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import SwiftUI

struct AnyPointSliderStyle: PointSliderStyle {
public struct AnyPointSliderStyle: PointSliderStyle {
private let styleMakeBody: (PointSliderStyle.Configuration) -> AnyView

init<S: PointSliderStyle>(_ style: S) {
public init<S: PointSliderStyle>(_ style: S) {
self.styleMakeBody = style.makeTypeErasedBody
}

func makeBody(configuration: PointSliderStyle.Configuration) -> AnyView {
public func makeBody(configuration: PointSliderStyle.Configuration) -> AnyView {
self.styleMakeBody(configuration)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

extension EnvironmentValues {
public extension EnvironmentValues {
var pointSliderStyle: AnyPointSliderStyle {
get {
return self[PointSliderStyleKey.self]
Expand All @@ -17,9 +17,9 @@ struct PointSliderStyleKey: EnvironmentKey {
)
}

extension View {
public extension View {
/// Sets the style for `PointSlider` within the environment of `self`.
public func pointSliderStyle<S>(_ style: S) -> some View where S : PointSliderStyle {
@inlinable func pointSliderStyle<S>(_ style: S) -> some View where S : PointSliderStyle {
self.environment(\.pointSliderStyle, AnyPointSliderStyle(style))
}
}
6 changes: 3 additions & 3 deletions Sources/Sliders/RangeSlider/Style/AnyRangeSliderStyle.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import SwiftUI

struct AnyRangeSliderStyle: RangeSliderStyle {
public struct AnyRangeSliderStyle: RangeSliderStyle {
private let styleMakeBody: (RangeSliderStyle.Configuration) -> AnyView

init<S: RangeSliderStyle>(_ style: S) {
public init<S: RangeSliderStyle>(_ style: S) {
self.styleMakeBody = style.makeTypeErasedBody
}

func makeBody(configuration: RangeSliderStyle.Configuration) -> AnyView {
public func makeBody(configuration: RangeSliderStyle.Configuration) -> AnyView {
self.styleMakeBody(configuration)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

extension EnvironmentValues {
public extension EnvironmentValues {
var rangeSliderStyle: AnyRangeSliderStyle {
get {
return self[RangeSliderStyleKey.self]
Expand All @@ -17,9 +17,9 @@ struct RangeSliderStyleKey: EnvironmentKey {
)
}

extension View {
public extension View {
/// Sets the style for `RangeSlider` within the environment of `self`.
public func rangeSliderStyle<S>(_ style: S) -> some View where S : RangeSliderStyle {
@inlinable func rangeSliderStyle<S>(_ style: S) -> some View where S : RangeSliderStyle {
self.environment(\.rangeSliderStyle, AnyRangeSliderStyle(style))
}
}
6 changes: 3 additions & 3 deletions Sources/Sliders/ValueSlider/Style/AnyValueSliderStyle.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import SwiftUI

struct AnyValueSliderStyle: ValueSliderStyle {
public struct AnyValueSliderStyle: ValueSliderStyle {
private let styleMakeBody: (ValueSliderStyle.Configuration) -> AnyView

init<S: ValueSliderStyle>(_ style: S) {
public init<S: ValueSliderStyle>(_ style: S) {
self.styleMakeBody = style.makeTypeErasedBody
}

func makeBody(configuration: ValueSliderStyle.Configuration) -> AnyView {
public func makeBody(configuration: ValueSliderStyle.Configuration) -> AnyView {
self.styleMakeBody(configuration)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

extension EnvironmentValues {
public extension EnvironmentValues {
var valueSliderStyle: AnyValueSliderStyle {
get {
return self[ValueSliderStyleKey.self]
Expand All @@ -17,9 +17,9 @@ struct ValueSliderStyleKey: EnvironmentKey {
)
}

extension View {
public extension View {
/// Sets the style for `ValueSlider` within the environment of `self`.
public func valueSliderStyle<S>(_ style: S) -> some View where S : ValueSliderStyle {
@inlinable func valueSliderStyle<S>(_ style: S) -> some View where S : ValueSliderStyle {
self.environment(\.valueSliderStyle, AnyValueSliderStyle(style))
}
}

0 comments on commit 135aef3

Please sign in to comment.