diff --git a/.swiftpm/xcode/package.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate b/.swiftpm/xcode/package.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..db85dcf Binary files /dev/null and b/.swiftpm/xcode/package.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/.swiftpm/xcode/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist b/.swiftpm/xcode/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..4dab9f5 --- /dev/null +++ b/.swiftpm/xcode/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + SlidingTabView.xcscheme_^#shared#^_ + + orderHint + 0 + + + SuppressBuildableAutocreation + + SlidingTabView + + primary + + + SlidingTabViewTests + + primary + + + + + diff --git a/Package.swift b/Package.swift index 0b07719..eab5dfb 100644 --- a/Package.swift +++ b/Package.swift @@ -5,6 +5,11 @@ import PackageDescription let package = Package( name: "SlidingTabView", + platforms: [ + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13) + ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( diff --git a/Sources/SlidingTabView/SlidingTabView.swift b/Sources/SlidingTabView/SlidingTabView.swift index cfd54f6..f8c1220 100644 --- a/Sources/SlidingTabView/SlidingTabView.swift +++ b/Sources/SlidingTabView/SlidingTabView.swift @@ -90,6 +90,7 @@ public struct SlidingTabView : View { selectionBarHeight: CGFloat = 2, selectionBarBackgroundColor: Color = Color.gray.opacity(0.2), selectionBarBackgroundHeight: CGFloat = 1) { + self.selectionState = selection.wrappedValue self._selection = selection self.tabs = tabs self.font = font @@ -123,14 +124,14 @@ public struct SlidingTabView : View { } } .padding(.vertical, 16) - .accentColor( - self.isSelected(tabIdentifier: tab) - ? self.activeAccentColor - : self.inactiveAccentColor) - .background( - self.isSelected(tabIdentifier: tab) - ? self.activeTabColor - : self.inactiveTabColor) + .accentColor( + self.isSelected(tabIdentifier: tab) + ? self.activeAccentColor + : self.inactiveAccentColor) + .background( + self.isSelected(tabIdentifier: tab) + ? self.activeTabColor + : self.inactiveTabColor) } } GeometryReader { geometry in @@ -168,20 +169,20 @@ public struct SlidingTabView : View { @available(iOS 13.0, *) struct SlidingTabConsumerView : View { - @State private var selectedTabIndex = 0 + @State private var selectedTabIndex = 1 var body: some View { VStack(alignment: .leading) { SlidingTabView(selection: self.$selectedTabIndex, - tabs: ["First", "Second"], - font: .body, - activeAccentColor: Color.blue, - selectionBarColor: Color.blue) + tabs: ["First", "Second"], + font: .body, + activeAccentColor: Color.blue, + selectionBarColor: Color.blue) (selectedTabIndex == 0 ? Text("First View") : Text("Second View")).padding() Spacer() } .padding(.top, 50) - .animation(.none) + .animation(.none) } }