Skip to content

Commit b46f1ba

Browse files
committed
Add list style initializer
1 parent 9afcbd1 commit b46f1ba

File tree

4 files changed

+47
-23
lines changed

4 files changed

+47
-23
lines changed

RELEASE_NOTES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@ This version adds new views.
2121

2222
* `OnboardingUspList` is a new view.
2323
* `OnboardingUspListStyle` is a new style.
24+
* `OnboardingUspListItem` is a new view.
25+
* `OnboardingUspListItemStyle` is a new style.
26+
* `OnboardingVerticalProgressList` is a new view.
27+
* `OnboardingVerticalProgressListStyle` is a new style.
28+
* `OnboardingVerticalProgressListStep` is a new style.
2429

2530
### 💡 Changes
2631

2732
* `OnboardingUspListItem` now applied a multiline mode to the text.
2833

2934

3035

31-
3236
## 9.0
3337

3438
This version makes the SDK target iOS 17 and aligned versions.

Sources/OnboardingKit/Views/OnboardingVerticalProgressList.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import SwiftUI
1515
public struct OnboardingVerticalProgressList: View {
1616

1717
public init(
18-
steps: [OnboardingVerticalProgressStep],
18+
steps: [OnboardingVerticalProgressListStep],
1919
stepIndex: Int,
2020
bundle: Bundle? = nil
2121
) {
@@ -24,7 +24,7 @@ public struct OnboardingVerticalProgressList: View {
2424
self.bundle = bundle ?? .module
2525
}
2626

27-
public typealias Step = OnboardingVerticalProgressStep
27+
public typealias Step = OnboardingVerticalProgressListStep
2828

2929
private let steps: [Step]
3030
private let currentStepIndex: Int
@@ -58,7 +58,7 @@ private extension OnboardingVerticalProgressList {
5858
return ZStack(alignment: .top) {
5959
if !isLast(index) {
6060
Rectangle()
61-
.frame(width: style.lineWidth)
61+
.frame(width: style.circleLineWidth)
6262
.frame(maxHeight: .infinity)
6363
}
6464
Image(systemName: "\(index+1).circle.fill")

Sources/OnboardingKit/Views/OnboardingVerticalProgressStep.swift renamed to Sources/OnboardingKit/Views/OnboardingVerticalProgressListStep.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// OnboardingVerticalProgressStep.swift
2+
// OnboardingVerticalProgressListStep.swift
33
// OnboardingKit
44
//
55
// Created by Daniel Saidi on 2025-11-22.
@@ -9,7 +9,7 @@
99
import SwiftUI
1010

1111
/// This model represents a step in a vertical progress list.
12-
public struct OnboardingVerticalProgressStep {
12+
public struct OnboardingVerticalProgressListStep {
1313

1414
public init(
1515
title: LocalizedStringKey,

Sources/OnboardingKit/Views/OnboardingVerticalProgressListStyle.swift

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,51 @@ import SwiftUI
1414
public struct OnboardingVerticalProgressListStyle {
1515

1616
public init(
17-
stepSpacing: Double = 20,
18-
circleSize: Double = 25,
19-
circleTextSpacing: Double = 20,
20-
circleColor: Color = .primary,
21-
circleActiveColor: Color = .blue,
22-
titleColor: Color = .primary,
23-
titleActiveColor: Color = .blue,
24-
lineWidth: Double = 5
17+
stepSpacing: Double? = nil,
18+
circleSize: Double? = nil,
19+
circleLineWidth: Double = 5,
20+
circleTextSpacing: Double? = nil,
21+
circleColor: Color? = nil,
22+
circleActiveColor: Color? = nil,
23+
titleColor: Color? = nil,
24+
titleActiveColor: Color? = nil
2525
) {
26-
self.stepSpacing = stepSpacing
27-
self.circleSize = circleSize
28-
self.circleTextSpacing = circleTextSpacing
29-
self.circleColor = circleColor
30-
self.circleActiveColor = circleActiveColor
31-
self.lineWidth = lineWidth
32-
self.titleColor = titleColor
33-
self.titleActiveColor = titleActiveColor
26+
self.stepSpacing = stepSpacing ?? 20
27+
self.circleSize = circleSize ?? 25
28+
self.circleLineWidth = circleLineWidth
29+
self.circleTextSpacing = circleTextSpacing ?? 20
30+
self.circleColor = circleColor ?? .primary
31+
self.circleActiveColor = circleActiveColor ?? .blue
32+
self.titleColor = titleColor ?? .primary
33+
self.titleActiveColor = titleActiveColor ?? .blue
34+
}
35+
36+
public init(
37+
stepSpacing: Double? = nil,
38+
circleSize: Double? = nil,
39+
circleLineWidth: Double = 5,
40+
circleTextSpacing: Double? = nil,
41+
accentColor: Color? = nil,
42+
activeAccentColor: Color? = nil
43+
) {
44+
self.init(
45+
stepSpacing: stepSpacing,
46+
circleSize: circleSize,
47+
circleLineWidth: circleLineWidth,
48+
circleTextSpacing: circleTextSpacing,
49+
circleColor: accentColor,
50+
circleActiveColor: activeAccentColor,
51+
titleColor: accentColor,
52+
titleActiveColor: activeAccentColor
53+
)
3454
}
3555

3656
public let stepSpacing: Double
3757
public let circleSize: Double
58+
public let circleLineWidth: Double
3859
public let circleTextSpacing: Double
3960
public let circleColor: Color
4061
public let circleActiveColor: Color
41-
public let lineWidth: Double
4262
public let titleColor: Color
4363
public let titleActiveColor: Color
4464
}

0 commit comments

Comments
 (0)