Skip to content

Commit 8f20afb

Browse files
committed
Move button type to separate SDK
1 parent 0a735f6 commit 8f20afb

8 files changed

Lines changed: 15 additions & 161 deletions

File tree

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.4
8+
9+
### 🗑️ Deprecations
10+
11+
* The `ButtonType` has been moved to the https://github.com/danielsaidi/ButtonKit repository.
12+
13+
14+
715
## 5.3
816

917
Thanks to [pnewell](https://github.com/pnewell), SwiftUIKit now supports Catalyst.

Sources/SwiftUIKit/Loading/DotLoadingAnimation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public struct DotLoadingAnimation: View {
3333
/// - interval: The timer tick interval in seconds, by default `0.8`.
3434
public init(
3535
dotCount: Int = 3,
36-
interval: Double = 0.8
36+
interval: Double = 0.25
3737
) {
3838
self.dotCount = dotCount
3939
self.timer = Timer.publish(every: interval, on: .main, in: .common)

Sources/SwiftUIKit/_Deprecated/Button+Init.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import SwiftUI
1212
public extension Button where Label == SwiftUI.Label<Text, Image> {
1313

1414
/// This initializer lets you use buttons with less code.
15+
@_disfavoredOverload
1516
init(
1617
_ text: LocalizedStringKey,
1718
_ icon: Image,

Sources/SwiftUIKit/Buttons/ButtonType.swift renamed to Sources/SwiftUIKit/_Deprecated/ButtonType.swift

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88

99
import SwiftUI
1010

11+
@available(*, deprecated, message: "ButtonType has been moved to https://github.com/danielsaidi/ButtonKit")
1112
public extension Button {
1213

1314
/// Create a new ``ButtonType``-based button.
1415
///
1516
/// You have to tint the icon separately for destructive
1617
/// buttons like ``ButtonType/delete``. This can be done
1718
/// automatically, by using `.labelStyle(.titleAndIcon)`.
19+
@_disfavoredOverload
1820
init(
1921
_ type: ButtonType,
2022
_ title: LocalizedStringKey? = nil,
@@ -37,9 +39,7 @@ public extension Button {
3739
}
3840
}
3941

40-
41-
/// This enum defines standard button types and provides
42-
/// standard localized texts and icons.
42+
@available(*, deprecated, message: "ButtonType has been moved to https://github.com/danielsaidi/ButtonKit")
4343
public enum ButtonType: String, CaseIterable, Identifiable {
4444
case add, addToFavorites,
4545
cancel, call, close, copy,
@@ -52,6 +52,7 @@ public enum ButtonType: String, CaseIterable, Identifiable {
5252
save, search, select, share
5353
}
5454

55+
@available(*, deprecated, message: "ButtonType has been moved to https://github.com/danielsaidi/ButtonKit")
5556
public extension ButtonType {
5657

5758
static func toggleFavorite(isFavorite: Bool) -> ButtonType {
@@ -65,10 +66,7 @@ public extension ButtonType {
6566
static func toggleSelect(isSelected: Bool) -> ButtonType {
6667
isSelected ? .deselect : .select
6768
}
68-
}
6969

70-
public extension ButtonType {
71-
7270
var id: String { rawValue }
7371

7472
var image: Image? {
@@ -152,6 +150,7 @@ public extension ButtonType {
152150
}
153151
}
154152

153+
@available(*, deprecated, message: "ButtonType has been moved to https://github.com/danielsaidi/ButtonKit")
155154
public extension View {
156155

157156
@ViewBuilder
@@ -173,35 +172,3 @@ public extension View {
173172
#endif
174173
}
175174
}
176-
177-
178-
#Preview {
179-
180-
@ViewBuilder
181-
func buttons() -> some View {
182-
Section {
183-
ForEach(ButtonType.allCases) { type in
184-
Button(type) { print("Tapped \(type.title)") }
185-
}
186-
}
187-
Section {
188-
Button(.toggleFavorite(isFavorite: false)) {}
189-
Button(.toggleFavorite(isFavorite: true)) {}
190-
Button(.toggleLike(isLiked: false)) {}
191-
Button(.toggleLike(isLiked: true)) {}
192-
Button(.toggleSelect(isSelected: false)) {}
193-
Button(.toggleSelect(isSelected: true)) {}
194-
}
195-
}
196-
197-
return List {
198-
buttons().labelStyle(.titleAndIcon)
199-
buttons().labelStyle(.titleOnly)
200-
buttons().labelStyle(.iconOnly)
201-
}
202-
.toolbar {
203-
ToolbarItemGroup {
204-
buttons()
205-
}
206-
}
207-
}

Tests/SwiftUIKitTests/Date/JSONDecoder+DateTests.swift

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

Tests/SwiftUIKitTests/Date/JSONEncoder+DateTests.swift

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

Tests/SwiftUIKitTests/Styles/CornerRadiusStyleTests.swift

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

Tests/SwiftUIKitTests/Styles/FontStyleTests.swift

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

0 commit comments

Comments
 (0)