Skip to content

Commit

Permalink
Patch 4.0.0
Browse files Browse the repository at this point in the history
perf:
- Improved library performance due to better task distribution between threads (#153)

fix:
- Fixed an issue with calling the library from non-main threads (#147)
- Fixed an issue that made it impossible to interact with the app when the overlay was set to clear (#150)
- Fixed a problem with the stacked popups background color
- Improved vertical popup animations

refactor:
- Renamed and changed some public API properties (see 3.x.x -> 4.0.0 Migration Guide for more information)
- Refactored several smaller files
  • Loading branch information
FulcrumOne authored Nov 17, 2024
1 parent c94c9a1 commit 9197026
Show file tree
Hide file tree
Showing 54 changed files with 2,410 additions and 2,310 deletions.
2 changes: 1 addition & 1 deletion MijickPopups.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Pod::Spec.new do |s|
MijickPopups solves two seemingly contradictory problems - to allow developers to create fully customizable popup, and to make the process as simple as possible.
DESC

s.version = '3.0.2'
s.version = '4.0.0'
s.ios.deployment_target = '14.0'
s.osx.deployment_target = '12.0'
s.tvos.deployment_target = '15.0'
Expand Down
29 changes: 29 additions & 0 deletions Sources/Internal/Configurables/Global/GlobalConfig+Center.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// GlobalConfig+Center.swift of MijickPopups
//
// Created by Tomasz Kurylik. Sending ❤️ from Kraków!
// - Mail: tomasz.kurylik@mijick.com
// - GitHub: https://github.com/FulcrumOne
// - Medium: https://medium.com/@mijick
//
// Copyright ©2024 Mijick. All rights reserved.


import SwiftUI

public final class GlobalConfigCenter: GlobalConfig { required public init() {}
// MARK: Active Variables
public var popupPadding: EdgeInsets = .init(top: 0, leading: 16, bottom: 0, trailing: 16)
public var cornerRadius: CGFloat = 24
public var backgroundColor: Color = .white
public var overlayColor: Color = .black.opacity(0.5)
public var isTapOutsideToDismissEnabled: Bool = false

// MARK: Inactive Variables
public var ignoredSafeAreaEdges: Edge.Set = []
public var heightMode: HeightMode = .auto
public var dragDetents: [DragDetent] = []
public var isDragGestureEnabled: Bool = false
public var dragThreshold: CGFloat = 0
public var isStackingEnabled: Bool = false
}
19 changes: 0 additions & 19 deletions Sources/Internal/Configurables/Global/GlobalConfig+Centre.swift

This file was deleted.

27 changes: 17 additions & 10 deletions Sources/Internal/Configurables/Global/GlobalConfig+Vertical.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@
// Copyright ©2024 Mijick. All rights reserved.


import Foundation
import SwiftUI

public extension GlobalConfig { class Vertical: GlobalConfig {
var dragThreshold: CGFloat = 1/3
var isStackingEnabled: Bool = true
var isDragGestureEnabled: Bool = true
public final class GlobalConfigVertical: GlobalConfig { required public init() {}
// MARK: Content
public var popupPadding: EdgeInsets = .init()
public var cornerRadius: CGFloat = 40
public var backgroundColor: Color = .white
public var overlayColor: Color = .black.opacity(0.5)
public var isStackingEnabled: Bool = true

// MARK: Gestures
public var isTapOutsideToDismissEnabled: Bool = false
public var isDragGestureEnabled: Bool = true
public var dragThreshold: CGFloat = 1/3

required init() { super.init()
self.popupPadding = .init()
self.cornerRadius = 40
}
}}
// MARK: Non-Customizable
public var ignoredSafeAreaEdges: Edge.Set = []
public var heightMode: HeightMode = .auto
public var dragDetents: [DragDetent] = []
}
9 changes: 3 additions & 6 deletions Sources/Internal/Configurables/Global/GlobalConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@

import SwiftUI

public class GlobalConfig { required init() {}
var popupPadding: EdgeInsets = .init()
var cornerRadius: CGFloat = 28
var backgroundColor: Color = .white
var overlayColor: Color = .black.opacity(0.44)
var isTapOutsideToDismissEnabled: Bool = false
public protocol GlobalConfig: LocalConfig {
var dragThreshold: CGFloat { get set }
var isStackingEnabled: Bool { get set }
}
27 changes: 27 additions & 0 deletions Sources/Internal/Configurables/Local/LocalConfig+Center.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// LocalConfig+Center.swift of MijickPopups
//
// Created by Tomasz Kurylik. Sending ❤️ from Kraków!
// - Mail: tomasz.kurylik@mijick.com
// - GitHub: https://github.com/FulcrumOne
// - Medium: https://medium.com/@mijick
//
// Copyright ©2024 Mijick. All rights reserved.


import SwiftUI

public class LocalConfigCenter: LocalConfig { required public init() {}
// MARK: Active Variables
public var popupPadding: EdgeInsets = GlobalConfigContainer.center.popupPadding
public var cornerRadius: CGFloat = GlobalConfigContainer.center.cornerRadius
public var backgroundColor: Color = GlobalConfigContainer.center.backgroundColor
public var overlayColor: Color = GlobalConfigContainer.center.overlayColor
public var isTapOutsideToDismissEnabled: Bool = GlobalConfigContainer.center.isTapOutsideToDismissEnabled

// MARK: Inactive Variables
public var ignoredSafeAreaEdges: Edge.Set = GlobalConfigContainer.center.ignoredSafeAreaEdges
public var heightMode: HeightMode = GlobalConfigContainer.center.heightMode
public var dragDetents: [DragDetent] = GlobalConfigContainer.center.dragDetents
public var isDragGestureEnabled: Bool = GlobalConfigContainer.center.isDragGestureEnabled
}
48 changes: 0 additions & 48 deletions Sources/Internal/Configurables/Local/LocalConfig+Centre.swift

This file was deleted.

71 changes: 17 additions & 54 deletions Sources/Internal/Configurables/Local/LocalConfig+Vertical.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,60 +11,23 @@

import SwiftUI

public extension LocalConfig { class Vertical: LocalConfig {
var ignoredSafeAreaEdges: Edge.Set = []
var heightMode: HeightMode = .auto
var dragDetents: [DragDetent] = []
var isDragGestureEnabled: Bool = GlobalConfigContainer.vertical.isDragGestureEnabled


required init() { super.init()
self.popupPadding = GlobalConfigContainer.vertical.popupPadding
self.cornerRadius = GlobalConfigContainer.vertical.cornerRadius
self.backgroundColor = GlobalConfigContainer.vertical.backgroundColor
self.overlayColor = GlobalConfigContainer.vertical.overlayColor
self.isTapOutsideToDismissEnabled = GlobalConfigContainer.vertical.isTapOutsideToDismissEnabled
}
}}

// MARK: Subclasses & Typealiases
/**
Configures the popup.
See the list of available methods in ``LocalConfig`` and ``LocalConfig/Vertical``.

- important: If a certain method is not called here, the popup inherits the configuration from ``GlobalConfigContainer``.
*/
public typealias TopPopupConfig = LocalConfig.Vertical.Top

/**
Configures the popup.
See the list of available methods in ``LocalConfig`` and ``LocalConfig/Vertical``.

- important: If a certain method is not called here, the popup inherits the configuration from ``GlobalConfigContainer``.
*/
public typealias BottomPopupConfig = LocalConfig.Vertical.Bottom
public extension LocalConfig.Vertical {
class Top: LocalConfig.Vertical {}
class Bottom: LocalConfig.Vertical {}
public class LocalConfigVertical: LocalConfig { required public init() {}
// MARK: Content
public var popupPadding: EdgeInsets = GlobalConfigContainer.vertical.popupPadding
public var cornerRadius: CGFloat = GlobalConfigContainer.vertical.cornerRadius
public var ignoredSafeAreaEdges: Edge.Set = GlobalConfigContainer.vertical.ignoredSafeAreaEdges
public var backgroundColor: Color = GlobalConfigContainer.vertical.backgroundColor
public var overlayColor: Color = GlobalConfigContainer.vertical.overlayColor
public var heightMode: HeightMode = GlobalConfigContainer.vertical.heightMode
public var dragDetents: [DragDetent] = GlobalConfigContainer.vertical.dragDetents

// MARK: Gestures
public var isTapOutsideToDismissEnabled: Bool = GlobalConfigContainer.vertical.isTapOutsideToDismissEnabled
public var isDragGestureEnabled: Bool = GlobalConfigContainer.vertical.isDragGestureEnabled
}



// MARK: - TESTS
#if DEBUG



extension LocalConfig.Vertical {
static func t_createNew<C: LocalConfig.Vertical>(popupPadding: EdgeInsets, cornerRadius: CGFloat, ignoredSafeAreaEdges: Edge.Set, heightMode: HeightMode, dragDetents: [DragDetent], isDragGestureEnabled: Bool) -> C {
let config = C()
config.popupPadding = popupPadding
config.cornerRadius = cornerRadius
config.ignoredSafeAreaEdges = ignoredSafeAreaEdges
config.heightMode = heightMode
config.dragDetents = dragDetents
config.isDragGestureEnabled = isDragGestureEnabled
return config
}
// MARK: Subclasses
public extension LocalConfigVertical {
class Top: LocalConfigVertical {}
class Bottom: LocalConfigVertical {}
}
#endif
19 changes: 13 additions & 6 deletions Sources/Internal/Configurables/Local/LocalConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@

import SwiftUI

public class LocalConfig { required init() {}
var popupPadding: EdgeInsets = .init()
var cornerRadius: CGFloat = 0
var backgroundColor: Color = .clear
var overlayColor: Color = .clear
var isTapOutsideToDismissEnabled: Bool = false
public protocol LocalConfig { init()
// MARK: Content
var popupPadding: EdgeInsets { get set }
var cornerRadius: CGFloat { get set }
var ignoredSafeAreaEdges: Edge.Set { get set }
var backgroundColor: Color { get set }
var overlayColor: Color { get set }
var heightMode: HeightMode { get set }
var dragDetents: [DragDetent] { get set }

// MARK: Gestures
var isTapOutsideToDismissEnabled: Bool { get set }
var isDragGestureEnabled: Bool { get set }
}
6 changes: 3 additions & 3 deletions Sources/Internal/Containers/GlobalConfigContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright ©2023 Mijick. All rights reserved.


public class GlobalConfigContainer {
nonisolated(unsafe) static var centre: GlobalConfig.Centre = .init()
nonisolated(unsafe) static var vertical: GlobalConfig.Vertical = .init()
public actor GlobalConfigContainer {
nonisolated(unsafe) static var center: GlobalConfigCenter = .init()
nonisolated(unsafe) static var vertical: GlobalConfigVertical = .init()
}
31 changes: 0 additions & 31 deletions Sources/Internal/Containers/PopupManagerContainer.swift

This file was deleted.

Loading

0 comments on commit 9197026

Please sign in to comment.