Skip to content

Commit 62457a9

Browse files
authored
Patch 4.0.1
fix: - Fixed a bug caused by the user declaring a value that caused the entire WindowGroup to be updated (#162)
1 parent 7b0a34e commit 62457a9

17 files changed

Lines changed: 88 additions & 46 deletions

MijickPopups.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Pod::Spec.new do |s|
55
MijickPopups solves two seemingly contradictory problems - to allow developers to create fully customizable popup, and to make the process as simple as possible.
66
DESC
77

8-
s.version = '4.0.0'
8+
s.version = '4.0.1'
99
s.ios.deployment_target = '14.0'
1010
s.osx.deployment_target = '12.0'
1111
s.tvos.deployment_target = '15.0'

README.md

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,83 @@
6363
<p>
6464
<!--Discord-->
6565
<a href="https://link.mijick.com/discord">
66-
<img alt="Join us on Discord" src="https://github.com/Mijick/Assets/blob/main/Popups/Buttons/discord.png" height="40px">
66+
<img alt="Join us on Discord" src="https://github.com/Mijick/Assets/blob/main/Common/Buttons/discord.png" height="40px">
6767
</a>
6868
<!--Linkedin-->
6969
<a href="https://link.mijick.com/linkedin">
70-
<img alt="Follow us on LinkedIn" src="https://github.com/Mijick/Assets/blob/main/Popups/Buttons/linkedin.png" height="40px">
70+
<img alt="Follow us on LinkedIn" src="https://github.com/Mijick/Assets/blob/main/Common/Buttons/linkedin.png" height="40px">
7171
</a>
7272
<!--GitHub-->
7373
<a href="https://link.mijick.com/github">
74-
<img alt="See our other frameworks" src="https://github.com/Mijick/Assets/blob/main/Popups/Buttons/github.png" height="40px">
74+
<img alt="See our other frameworks" src="https://github.com/Mijick/Assets/blob/main/Common/Buttons/github.png" height="40px">
7575
</a>
7676
<!--Medium-->
7777
<a href="https://link.mijick.com/medium">
78-
<img alt="Read us on Medium" src="https://github.com/Mijick/Assets/blob/main/Popups/Buttons/medium.png" height="40px">
78+
<img alt="Read us on Medium" src="https://github.com/Mijick/Assets/blob/main/Common/Buttons/medium.png" height="40px">
7979
</a>
8080
<!--Buymeacoffee-->
8181
<a href="https://link.mijick.com/buymeacoffee">
82-
<img alt="Buy us a coffee" src="https://github.com/Mijick/Assets/blob/main/Popups/Buttons/buymeacoffee.png" height="40px">
82+
<img alt="Buy us a coffee" src="https://github.com/Mijick/Assets/blob/main/Common/Buttons/buymeacoffee.png" height="40px">
8383
</a>
8484
</p>
8585

86+
<!--Features-->
87+
# ✨ Features
88+
<table><tbody>
89+
<tr>
90+
<td>📱</td>
91+
<td>Three positions for the popups: Top, Center or Bottom</td>
92+
</tr>
93+
<tr>
94+
<td>🎁</td>
95+
<td>Stackable popups</td>
96+
</tr>
97+
<tr>
98+
<td>🐫</td>
99+
<td>Three height modes: Automatic, Large or Fullscreen</td>
100+
</tr>
101+
<tr>
102+
<td>⛹️</td>
103+
<td>Resizable popups</td>
104+
</tr>
105+
<tr>
106+
<td>🍃</td>
107+
<td>Automatic dismissal</td>
108+
</tr>
109+
<tr>
110+
<td>🖖</td>
111+
<td>Super easy to use from any place in the code</td>
112+
</tr>
113+
<tr>
114+
<td>🚧</td>
115+
<td>Fully customizable</td>
116+
</tr>
117+
<tr>
118+
<td>🕺</td>
119+
<td>Beautiful animations</td>
120+
</tr>
121+
<tr>
122+
<td>🤏🏼</td>
123+
<td>Gestures support</td>
124+
</tr>
125+
<tr>
126+
<td>🍏</td>
127+
<td>Works with SwiftUI sheets</td>
128+
</tr>
129+
<tr>
130+
<td>🖥️</td>
131+
<td>Supports iOS, macOS, tvOS, watchOS and visionOS</td>
132+
</tr>
133+
<tr>
134+
<td>⚡️</td>
135+
<td>Supports Swift 6</td>
136+
</tr>
137+
<tr>
138+
<td>🚀</td>
139+
<td>... and others</td>
140+
</tr>
141+
</tbody></table>
142+
86143
<!--Description-->
87144
# ☀️ Why MijickPopups?
88145
MijickPopups library solves two seemingly contradictory problems - to allow developers to create fully customizable popup views, and to make the process as simple as possible. Here is why we think we have successfully met these objectives:
@@ -145,7 +202,7 @@ Join the welcoming community of developers on [Discord](https://link.mijick.com/
145202
# 🌼 Contribute
146203
To contribute a feature or idea to **MijickPopups**, create an [issue](https://github.com/Mijick/Popups/issues/new?assignees=FulcrumOne&labels=state%3A+inactive%2C+type%3A+feature&projects=&template=🚀-feature-request.md&title=%5BFREQ%5D) explaining your idea or bring it up on [Discord](https://discord.com/invite/dT5V7nm5SC). <br>
147204
If you find a bug, please create an [issue](https://github.com/Mijick/Popups/issues/new?assignees=FulcrumOne%2C+jay-jay-lama&labels=state%3A+inactive%2C+type%3A+bug&projects=&template=🦟-bug-report.md&title=%5BBUG%5D). <br>
148-
If you would like to contribute, please refer to the [Contribution Guidelines](https://link.mijick.com/contribution-guidelines).
205+
If you would like to contribute, please refer to the [Contribution Guidelines](https://github.com/Mijick/Popups/blob/main/.github/CONTRIBUTING.md).
149206

150207
<!--Sponsorship-->
151208
# 💜 Sponsor our work

Sources/Internal/Containers/PopupStack.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ extension PopupStack {
2727
}
2828

2929

30-
3130
// MARK: - STACK OPERATIONS
3231

3332

@@ -96,7 +95,6 @@ private extension PopupStack {
9695
}
9796

9897

99-
10098
// MARK: - STACK CONTAINER OPERATIONS
10199

102100

Sources/Internal/Models/AnyPopup.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ struct AnyPopup: Popup {
2424
}
2525

2626

27-
2827
// MARK: - INITIALIZE & UPDATE
2928

3029

@@ -70,7 +69,6 @@ private extension AnyPopup {
7069
}
7170

7271

73-
7472
// MARK: - PROTOCOLS CONFORMANCE
7573

7674

Sources/Internal/Models/ID+Popup.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ extension PopupID {
3737
}
3838

3939

40-
4140
// MARK: - HELPERS
4241

4342

Sources/Internal/UI/PopupCenterStackView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ struct PopupCenterStackView: View {
1515
@ObservedObject var viewModel: VM.CenterStack
1616

1717

18-
var body: some View {
18+
var body: some View { if viewModel.screen.height > 0 {
1919
ZStack(content: createPopupStack)
2020
.id(viewModel.popups.isEmpty)
2121
.transition(transition)
2222
.frame(maxWidth: .infinity, maxHeight: viewModel.screen.height)
23-
}
23+
}}
2424
}
2525
private extension PopupCenterStackView {
2626
func createPopupStack() -> some View {

Sources/Internal/UI/PopupVerticalStackView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ struct PopupVerticalStackView: View {
1515
@ObservedObject var viewModel: VM.VerticalStack
1616

1717

18-
var body: some View {
18+
var body: some View { if viewModel.screen.height > 0 {
1919
ZStack(alignment: (!viewModel.alignment).toAlignment(), content: createPopupStack)
2020
.frame(height: viewModel.screen.height, alignment: viewModel.alignment.toAlignment())
2121
.onDragGesture(onChanged: viewModel.onPopupDragGestureChanged, onEnded: viewModel.onPopupDragGestureEnded, isEnabled: viewModel.dragGestureEnabled)
22-
}
22+
}}
2323
}
2424
private extension PopupVerticalStackView {
2525
func createPopupStack() -> some View {

Sources/Internal/UI/PopupView.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ struct PopupView: View {
2222
private let bottomStackViewModel: VM.VerticalStack = .init(BottomPopupConfig.self)
2323

2424

25+
init(rootView: any View, popupStack: PopupStack) {
26+
#if os(tvOS)
27+
self.rootView = rootView
28+
#endif
29+
self.stack = popupStack
30+
31+
Task { [self] in await updateViewModels { await $0.updatePopups(stack.popups) } }
32+
}
2533
var body: some View {
2634
#if os(tvOS)
2735
AnyView(rootView)

Sources/Internal/View Models/ViewModel+CentreStack.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ extension VM { class CenterStack: ViewModel { required init() {}
1616
var popups: [AnyPopup] = []
1717
var activePopupProperties: ActivePopupProperties = .init()
1818
var screen: Screen = .init()
19-
var updatePopupAction: ((AnyPopup) async -> ())!
20-
var closePopupAction: ((AnyPopup) async -> ())!
19+
var updatePopupAction: ((AnyPopup) async -> ())?
20+
var closePopupAction: ((AnyPopup) async -> ())?
2121
}}
2222

2323

24-
2524
// MARK: - METHODS / VIEW MODEL / ACTIVE POPUP
2625

2726

@@ -84,7 +83,6 @@ extension VM.CenterStack {
8483
}
8584

8685

87-
8886
// MARK: - METHODS / VIEW MODEL / SELECTED POPUP
8987

9088

@@ -104,7 +102,6 @@ private extension VM.CenterStack {
104102
}
105103

106104

107-
108105
// MARK: - METHODS / VIEW
109106

110107

Sources/Internal/View Models/ViewModel+VerticalStack.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ extension VM { class VerticalStack: ViewModel { required init() {}
1616
var popups: [AnyPopup] = []
1717
var activePopupProperties: ActivePopupProperties = .init()
1818
var screen: Screen = .init()
19-
var updatePopupAction: ((AnyPopup) async -> ())!
20-
var closePopupAction: ((AnyPopup) async -> ())!
19+
var updatePopupAction: ((AnyPopup) async -> ())?
20+
var closePopupAction: ((AnyPopup) async -> ())?
2121
}}
2222

2323

24-
2524
// MARK: - METHODS / VIEW MODEL / ACTIVE POPUP
2625

2726

@@ -171,7 +170,6 @@ extension VM.VerticalStack {
171170
}
172171

173172

174-
175173
// MARK: - METHODS / VIEW MODEL / SELECTED POPUP
176174

177175

@@ -214,7 +212,6 @@ private extension VM.VerticalStack {
214212
}
215213

216214

217-
218215
// MARK: - METHODS / VIEW
219216

220217

@@ -307,7 +304,6 @@ extension VM.VerticalStack {
307304
}
308305

309306

310-
311307
// MARK: - GESTURES
312308

313309

@@ -371,7 +367,7 @@ extension VM.VerticalStack {
371367
}
372368
private extension VM.VerticalStack {
373369
func dismissLastPopupIfNeeded(_ popup: AnyPopup) async { switch activePopupProperties.translationProgress >= dragThreshold {
374-
case true: await closePopupAction(popup)
370+
case true: await closePopupAction?(popup)
375371
case false: return
376372
}}
377373
func calculateTargetDragHeight(_ activePopup: AnyPopup) async -> CGFloat {

0 commit comments

Comments
 (0)