Skip to content

Commit 11c1e6d

Browse files
committed
Move PageView to separate repository
1 parent 4ace13f commit 11c1e6d

11 files changed

+63
-177
lines changed

RELEASE_NOTES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ SwiftUIKit makes its best effort to honor semver, but breaking changes can occur
44

55

66

7+
## 5.6
8+
9+
### 🗑️ Deprecations
10+
11+
* The `PageView` and all related types have been moved to https://github.com/danielsaidi/PageView.
12+
13+
14+
715
## 5.5
816

917
### 🗑️ Deprecations

Sources/SwiftUIKit/Pages/PageView+Previews.swift

Lines changed: 0 additions & 82 deletions
This file was deleted.

Sources/SwiftUIKit/SwiftUIKit.docc/SwiftUIKit.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ SwiftUIKit is available under the MIT license.
6262
### Data
6363

6464
- ``CsvParser``
65+
- ``FetchedDataView``
6566
- ``MimeType``
6667
- ``ScanCodeType``
6768
- ``StorageValue``
@@ -85,20 +86,10 @@ SwiftUIKit is available under the MIT license.
8586
- ``DirectoryObservable``
8687
- ``iCloudDocumentSync``
8788

88-
### Flip
89-
90-
- ``FlipView``
91-
- ``FlipDirection``
92-
9389
### Fonts
9490

9591
- ``FontRepresentable``
9692

97-
### Gestures
98-
99-
- ``GestureTimer``
100-
- ``SwipeGestureViewModifier``
101-
10293
### Images
10394

10495
- ``ImageCache``
@@ -143,13 +134,6 @@ SwiftUIKit is available under the MIT license.
143134
- ``NavigationContext``
144135
- ``NavigationLinkArrow``
145136

146-
### Pages
147-
148-
- ``PageIndicator``
149-
- ``PageIndicatorDisplayMode``
150-
- ``PageIndicatorStyle``
151-
- ``PageView``
152-
153137
### Pasteboard
154138

155139
- ``Pasteboard``
@@ -213,7 +197,6 @@ SwiftUIKit is available under the MIT license.
213197

214198
### Views
215199

216-
- ``CustomRoundedRectangle``
217200
- ``EditableView``
218201

219202

Sources/SwiftUIKit/_Deprecated/FlipView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public extension FlipView {
7676
}
7777
}
7878

79+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/FlipKit")
7980
private extension View {
8081

8182
typealias FlipAction = (FlipDirection) -> Void
@@ -157,8 +158,9 @@ private extension FlipView {
157158
}
158159
}
159160

161+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/FlipKit")
160162
private extension View {
161-
163+
162164
@ViewBuilder
163165
func rotationEffect(
164166
_ angles: Angle,

Sources/SwiftUIKit/Pages/PageIndicator.swift renamed to Sources/SwiftUIKit/_Deprecated/PageIndicator.swift

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88

99
import SwiftUI
1010

11-
/**
12-
This view can be used to display a horizontal collection of
13-
dots that are bound to pages in a page view.
14-
15-
You can use this view to customize the style of the dots in
16-
a `TabView` (or ``PageView``).
17-
*/
11+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
1812
public struct PageIndicator: View {
1913

2014
/**
@@ -50,42 +44,16 @@ public struct PageIndicator: View {
5044
}
5145
}
5246
}
53-
}
5447

55-
private extension PageIndicator {
56-
57-
func isCurrentPage(_ index: Int) -> Bool {
48+
private func isCurrentPage(_ index: Int) -> Bool {
5849
index == currentPageIndex.wrappedValue
5950
}
6051

61-
func setCurrentPage(_ index: Int) {
52+
private func setCurrentPage(_ index: Int) {
6253
if style.isAnimated {
6354
withAnimation { currentPageIndex.wrappedValue = index }
6455
} else {
6556
currentPageIndex.wrappedValue = index
6657
}
6758
}
6859
}
69-
70-
#Preview {
71-
72-
VStack(spacing: 20) {
73-
PageIndicator(
74-
numberOfPages: 10,
75-
currentPageIndex: .constant(3)
76-
)
77-
78-
PageIndicator(
79-
numberOfPages: 5,
80-
currentPageIndex: .constant(3)
81-
)
82-
.pageIndicatorStyle(.init(
83-
dotColor: .blue,
84-
dotSpacing: 20,
85-
currentDotColor: .yellow
86-
))
87-
}
88-
.padding()
89-
.background(Color.gray)
90-
.cornerRadius(20)
91-
}

Sources/SwiftUIKit/Pages/PageIndicatorDisplayMode.swift renamed to Sources/SwiftUIKit/_Deprecated/PageIndicatorDisplayMode.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import SwiftUI
1010

11-
/// This enum mimics `PageTabViewStyle.IndexDisplayMode`.
11+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
1212
public enum PageIndicatorDisplayMode {
1313

1414
/// Always display a page indicator regardless of page count.
@@ -22,6 +22,7 @@ public enum PageIndicatorDisplayMode {
2222
}
2323

2424
#if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
25+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
2526
extension PageIndicatorDisplayMode {
2627

2728
var tabViewMode: PageTabViewStyle.IndexDisplayMode {

Sources/SwiftUIKit/Pages/PageIndicatorStyle.swift renamed to Sources/SwiftUIKit/_Deprecated/PageIndicatorStyle.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import SwiftUI
1010

11-
/// This style can be used to style a ``PageIndicator``.
11+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
1212
public struct PageIndicatorStyle: Equatable {
1313

1414
/// Create a custom page indicator style.
@@ -55,12 +55,14 @@ public struct PageIndicatorStyle: Equatable {
5555
public var isAnimated: Bool
5656
}
5757

58+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
5859
public extension PageIndicatorStyle {
5960

6061
/// The standard page indicator style.
6162
static var standard: Self { .init() }
6263
}
6364

65+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
6466
public extension View {
6567

6668
/// Apply a ``PageIndicatorStyle`` style to the view.
@@ -71,6 +73,7 @@ public extension View {
7173
}
7274
}
7375

76+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
7477
private extension PageIndicatorStyle {
7578

7679
@MainActor struct Key: @preconcurrency EnvironmentKey {
@@ -81,6 +84,7 @@ private extension PageIndicatorStyle {
8184
}
8285
}
8386

87+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
8488
public extension EnvironmentValues {
8589

8690
var pageIndicatorStyle: PageIndicatorStyle {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// PageView+Previews.swift
3+
// SwiftUIKit
4+
//
5+
// Created by Daniel Saidi on 2022-03-30.
6+
// Copyright © 2020-2025 Daniel Saidi. All rights reserved.
7+
//
8+
9+
import SwiftUI
10+
11+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
12+
private enum PreviewPageType: String, CaseIterable {
13+
14+
case red, green, blue
15+
16+
var color: Color {
17+
switch self {
18+
case .red: return .red
19+
case .green: return .green
20+
case .blue: return .blue
21+
}
22+
}
23+
}
24+
25+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
26+
private struct PreviewPage: View {
27+
28+
let type: PreviewPageType
29+
30+
var body: some View {
31+
type.color.opacity(0.5)
32+
.overlay(Text("Preview.Page.\(type.rawValue)", bundle: .module)
33+
.foregroundColor(.white)
34+
)
35+
}
36+
}

Sources/SwiftUIKit/Pages/PageView.swift renamed to Sources/SwiftUIKit/_Deprecated/PageView.swift

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,7 @@
99
#if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
1010
import SwiftUI
1111

12-
/**
13-
This view wraps its pages within a `.page` styled `TabView`.
14-
15-
You can set it up with a fixed set of `pages` or with a set
16-
of `items` to which you apply a dynamic page builder.
17-
18-
The view is a semantic alias for `TabView`, since I think a
19-
"page view" is conceptually different from a "tab view". It
20-
also has a macOS version, which means that you can use this
21-
view in the same way on all platforms.
22-
23-
The view supports styling some parts of the native page dot
24-
views with a ``PageIndicatorStyle`` for iOS and tvOS, using
25-
UIKit appearance proxies. This however means that all views
26-
of this type are affected. For a more flexible and isolated
27-
approach, use `never` as `pageIndicatorDisplayMode` and add
28-
a ``PageIndicator`` view as an overlay.
29-
*/
12+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
3013
public struct PageView<PageViewType: View>: View {
3114

3215
/// Create a page view with a set of page views.
@@ -85,11 +68,8 @@ public struct PageView<PageViewType: View>: View {
8568
.onAppear(perform: trySetupStyle)
8669
.tabViewStyle(.page(indexDisplayMode: pageIndicatorDisplayMode.tabViewMode))
8770
}
88-
}
8971

90-
private extension PageView {
91-
92-
func trySetupStyle() {
72+
private func trySetupStyle() {
9373
#if os(iOS) || os(tvOS)
9474
let style = pageIndicatorStyle
9575
let appearance = UIPageControl.appearance()

Sources/SwiftUIKit/Pages/PageView_macOS.swift renamed to Sources/SwiftUIKit/_Deprecated/PageView_macOS.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@
1010
import SwiftUI
1111
import Combine
1212

13-
/**
14-
This view mimics a `.page` styled iOS `TabView`.
15-
16-
You can set up the view with a set of `pages` or `items` to
17-
which you apply a dynamic page builder.
18-
*/
13+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
1914
public struct PageView<PageViewType: View>: View {
2015

2116
/// Create a page view with a set of page views.
@@ -81,6 +76,7 @@ public struct PageView<PageViewType: View>: View {
8176
}
8277
}
8378

79+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
8480
private extension PageView {
8581

8682
@ViewBuilder
@@ -120,6 +116,7 @@ private extension PageView {
120116
}
121117
}
122118

119+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PageView")
123120
private extension PageView {
124121

125122
var shouldShowPageIndicator: Bool {

0 commit comments

Comments
 (0)