Skip to content

Commit

Permalink
#535 Remove needless async code
Browse files Browse the repository at this point in the history
  • Loading branch information
wtmoose committed Dec 3, 2023
1 parent 95f65d5 commit 633b6e5
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 118 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PackageDescription
let package = Package(
name: "SwiftMessages",
platforms: [
.iOS("9.0")
.iOS("13.0")
],
products: [
.library(name: "SwiftMessages", targets: ["SwiftMessages"]),
Expand Down
4 changes: 2 additions & 2 deletions SwiftMessages.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Pod::Spec.new do |spec|
spec.authors = { 'Timothy Moose' => '[email protected]' }
spec.summary = 'A very flexible message bar for iOS written in Swift.'
spec.source = {:git => 'https://github.com/SwiftKickMobile/SwiftMessages.git', :tag => spec.version}
spec.platform = :ios, '12.0'
spec.platform = :ios, '13.0'
spec.swift_version = '5.0'
spec.ios.deployment_target = '12.0'
spec.ios.deployment_target = '13.0'
spec.framework = 'UIKit'
spec.requires_arc = true
spec.default_subspec = 'App'
Expand Down
16 changes: 11 additions & 5 deletions SwiftMessages.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
2298C2071EE480D000E2DDC1 /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2298C2061EE480D000E2DDC1 /* Animator.swift */; };
2298C2091EE486E300E2DDC1 /* TopBottomAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2298C2081EE486E300E2DDC1 /* TopBottomAnimation.swift */; };
229F778125FAB1E9008C2ACB /* UIWindow+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 229F778025FAB1E9008C2ACB /* UIWindow+Extensions.swift */; };
22D3B4562B1CEF76002D8665 /* Task+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22D3B4552B1CEF76002D8665 /* Task+Extensions.swift */; };
22DFC9161EFF30F6001B1CA1 /* CenteredView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 22DFC9151EFF30F6001B1CA1 /* CenteredView.xib */; };
22DFC9181F00674E001B1CA1 /* PhysicsPanHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22DFC9171F00674E001B1CA1 /* PhysicsPanHandler.swift */; };
22E01F641E74EC8B00ACE19A /* MaskingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22E01F631E74EC8B00ACE19A /* MaskingView.swift */; };
Expand Down Expand Up @@ -151,6 +152,7 @@
2298C2081EE486E300E2DDC1 /* TopBottomAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TopBottomAnimation.swift; sourceTree = "<group>"; };
229F778025FAB1E9008C2ACB /* UIWindow+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIWindow+Extensions.swift"; sourceTree = "<group>"; };
22A2EA6E24EC6CFA00BB2540 /* Package.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
22D3B4552B1CEF76002D8665 /* Task+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Task+Extensions.swift"; sourceTree = "<group>"; };
22DFC9151EFF30F6001B1CA1 /* CenteredView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CenteredView.xib; path = Resources/CenteredView.xib; sourceTree = "<group>"; };
22DFC9171F00674E001B1CA1 /* PhysicsPanHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhysicsPanHandler.swift; sourceTree = "<group>"; };
22E01F631E74EC8B00ACE19A /* MaskingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaskingView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -220,6 +222,7 @@
220655111FAF82B600F4E00F /* MarginAdjustable+Extensions.swift */,
22774B9F20B5EF2A00813732 /* UIEdgeInsets+Extensions.swift */,
229F778025FAB1E9008C2ACB /* UIWindow+Extensions.swift */,
22D3B4552B1CEF76002D8665 /* Task+Extensions.swift */,
);
name = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -453,7 +456,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 1500;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "SwiftKick Mobile";
TargetAttributes = {
86B48AEB1D5A41C900063E2B = {
Expand Down Expand Up @@ -556,6 +559,7 @@
22F27951210CE25900273E7F /* CornerRoundingView.swift in Sources */,
86BBA9011D5E040600FE8F16 /* PassthroughWindow.swift in Sources */,
2298C2071EE480D000E2DDC1 /* Animator.swift in Sources */,
22D3B4562B1CEF76002D8665 /* Task+Extensions.swift in Sources */,
86BBA9031D5E040600FE8F16 /* UIViewController+Extensions.swift in Sources */,
228F7DDF2ACF703A006C9644 /* SwiftMessageModifier.swift in Sources */,
224FB69921153B440081D4DE /* CALayer+Extensions.swift in Sources */,
Expand Down Expand Up @@ -609,6 +613,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
Expand Down Expand Up @@ -655,7 +660,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -668,6 +673,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
Expand Down Expand Up @@ -708,7 +714,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
Expand All @@ -732,7 +738,7 @@
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
INFOPLIST_FILE = SwiftMessages/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -767,7 +773,7 @@
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
INFOPLIST_FILE = SwiftMessages/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
13 changes: 6 additions & 7 deletions SwiftMessages/KeyboardTrackingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,12 @@ open class KeyboardTrackingView: UIView {
self.didChange(change: change, userInfo: userInfo)
self.delegate?.keyboardTrackingViewDidChange(change: change, userInfo: userInfo)
}
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDuration(durationNumber.doubleValue)
UIView.setAnimationCurve(UIView.AnimationCurve(rawValue: curveNumber.intValue)!)
UIView.setAnimationBeginsFromCurrentState(true)
self.superview?.layoutIfNeeded()
UIView.commitAnimations()
CATransaction.commit()
let curve = UIView.AnimationCurve(rawValue: curveNumber.intValue) ?? .easeInOut
let animation = UIViewPropertyAnimator(duration: durationNumber.doubleValue, curve: curve) {
self.updateConstraintsIfNeeded()
self.superview?.layoutIfNeeded()
}
animation.startAnimation()
}
}

Expand Down
2 changes: 2 additions & 0 deletions SwiftMessages/Presenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ protocol PresenterDelegate: AnimationDelegate {
func hide(presenter: Presenter)
}

@MainActor
class Presenter: NSObject {

// MARK: - API
Expand Down Expand Up @@ -77,6 +78,7 @@ class Presenter: NSObject {

// MARK: - Constants

@MainActor
enum PresentationContext {
case viewController(_: Weak<UIViewController>)
case view(_: Weak<UIView>)
Expand Down
2 changes: 1 addition & 1 deletion SwiftMessages/SwiftMessageModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private struct SwiftMessageModifier<Message>: ViewModifier where Message: Messag
content
.onChange(of: message) { _ in
if let message {
let show: (SwiftMessages.Config, UIView) -> Void = swiftMessages?.show(config:view:) ?? SwiftMessages.show(config:view:)
let show: @MainActor (SwiftMessages.Config, UIView) -> Void = swiftMessages?.show(config:view:) ?? SwiftMessages.show(config:view:)
let view = MessageHostingView(message: message)
var config = config ?? swiftMessages?.defaultConfig ?? SwiftMessages.defaultConfig
config.eventListeners.append { event in
Expand Down
Loading

0 comments on commit 633b6e5

Please sign in to comment.