Skip to content

Commit 633b6e5

Browse files
committed
#535 Remove needless async code
1 parent 95f65d5 commit 633b6e5

9 files changed

+105
-118
lines changed

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import PackageDescription
44
let package = Package(
55
name: "SwiftMessages",
66
platforms: [
7-
.iOS("9.0")
7+
.iOS("13.0")
88
],
99
products: [
1010
.library(name: "SwiftMessages", targets: ["SwiftMessages"]),

SwiftMessages.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Pod::Spec.new do |spec|
66
spec.authors = { 'Timothy Moose' => 'tim@swiftkickmobile.com' }
77
spec.summary = 'A very flexible message bar for iOS written in Swift.'
88
spec.source = {:git => 'https://github.com/SwiftKickMobile/SwiftMessages.git', :tag => spec.version}
9-
spec.platform = :ios, '12.0'
9+
spec.platform = :ios, '13.0'
1010
spec.swift_version = '5.0'
11-
spec.ios.deployment_target = '12.0'
11+
spec.ios.deployment_target = '13.0'
1212
spec.framework = 'UIKit'
1313
spec.requires_arc = true
1414
spec.default_subspec = 'App'

SwiftMessages.xcodeproj/project.pbxproj

+11-5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
2298C2071EE480D000E2DDC1 /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2298C2061EE480D000E2DDC1 /* Animator.swift */; };
6060
2298C2091EE486E300E2DDC1 /* TopBottomAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2298C2081EE486E300E2DDC1 /* TopBottomAnimation.swift */; };
6161
229F778125FAB1E9008C2ACB /* UIWindow+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 229F778025FAB1E9008C2ACB /* UIWindow+Extensions.swift */; };
62+
22D3B4562B1CEF76002D8665 /* Task+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22D3B4552B1CEF76002D8665 /* Task+Extensions.swift */; };
6263
22DFC9161EFF30F6001B1CA1 /* CenteredView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 22DFC9151EFF30F6001B1CA1 /* CenteredView.xib */; };
6364
22DFC9181F00674E001B1CA1 /* PhysicsPanHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22DFC9171F00674E001B1CA1 /* PhysicsPanHandler.swift */; };
6465
22E01F641E74EC8B00ACE19A /* MaskingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22E01F631E74EC8B00ACE19A /* MaskingView.swift */; };
@@ -151,6 +152,7 @@
151152
2298C2081EE486E300E2DDC1 /* TopBottomAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TopBottomAnimation.swift; sourceTree = "<group>"; };
152153
229F778025FAB1E9008C2ACB /* UIWindow+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIWindow+Extensions.swift"; sourceTree = "<group>"; };
153154
22A2EA6E24EC6CFA00BB2540 /* Package.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
155+
22D3B4552B1CEF76002D8665 /* Task+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Task+Extensions.swift"; sourceTree = "<group>"; };
154156
22DFC9151EFF30F6001B1CA1 /* CenteredView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CenteredView.xib; path = Resources/CenteredView.xib; sourceTree = "<group>"; };
155157
22DFC9171F00674E001B1CA1 /* PhysicsPanHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhysicsPanHandler.swift; sourceTree = "<group>"; };
156158
22E01F631E74EC8B00ACE19A /* MaskingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaskingView.swift; sourceTree = "<group>"; };
@@ -220,6 +222,7 @@
220222
220655111FAF82B600F4E00F /* MarginAdjustable+Extensions.swift */,
221223
22774B9F20B5EF2A00813732 /* UIEdgeInsets+Extensions.swift */,
222224
229F778025FAB1E9008C2ACB /* UIWindow+Extensions.swift */,
225+
22D3B4552B1CEF76002D8665 /* Task+Extensions.swift */,
223226
);
224227
name = Extensions;
225228
sourceTree = "<group>";
@@ -453,7 +456,7 @@
453456
attributes = {
454457
BuildIndependentTargetsInParallel = YES;
455458
LastSwiftUpdateCheck = 0730;
456-
LastUpgradeCheck = 1500;
459+
LastUpgradeCheck = 1510;
457460
ORGANIZATIONNAME = "SwiftKick Mobile";
458461
TargetAttributes = {
459462
86B48AEB1D5A41C900063E2B = {
@@ -556,6 +559,7 @@
556559
22F27951210CE25900273E7F /* CornerRoundingView.swift in Sources */,
557560
86BBA9011D5E040600FE8F16 /* PassthroughWindow.swift in Sources */,
558561
2298C2071EE480D000E2DDC1 /* Animator.swift in Sources */,
562+
22D3B4562B1CEF76002D8665 /* Task+Extensions.swift in Sources */,
559563
86BBA9031D5E040600FE8F16 /* UIViewController+Extensions.swift in Sources */,
560564
228F7DDF2ACF703A006C9644 /* SwiftMessageModifier.swift in Sources */,
561565
224FB69921153B440081D4DE /* CALayer+Extensions.swift in Sources */,
@@ -609,6 +613,7 @@
609613
isa = XCBuildConfiguration;
610614
buildSettings = {
611615
ALWAYS_SEARCH_USER_PATHS = NO;
616+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
612617
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
613618
CLANG_ANALYZER_NONNULL = YES;
614619
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -655,7 +660,7 @@
655660
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
656661
GCC_WARN_UNUSED_FUNCTION = YES;
657662
GCC_WARN_UNUSED_VARIABLE = YES;
658-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
663+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
659664
MTL_ENABLE_DEBUG_INFO = YES;
660665
ONLY_ACTIVE_ARCH = YES;
661666
SDKROOT = iphoneos;
@@ -668,6 +673,7 @@
668673
isa = XCBuildConfiguration;
669674
buildSettings = {
670675
ALWAYS_SEARCH_USER_PATHS = NO;
676+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
671677
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
672678
CLANG_ANALYZER_NONNULL = YES;
673679
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -708,7 +714,7 @@
708714
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
709715
GCC_WARN_UNUSED_FUNCTION = YES;
710716
GCC_WARN_UNUSED_VARIABLE = YES;
711-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
717+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
712718
MTL_ENABLE_DEBUG_INFO = NO;
713719
SDKROOT = iphoneos;
714720
SWIFT_COMPILATION_MODE = wholemodule;
@@ -732,7 +738,7 @@
732738
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
733739
INFOPLIST_FILE = SwiftMessages/Info.plist;
734740
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
735-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
741+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
736742
LD_RUNPATH_SEARCH_PATHS = (
737743
"$(inherited)",
738744
"@executable_path/Frameworks",
@@ -767,7 +773,7 @@
767773
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
768774
INFOPLIST_FILE = SwiftMessages/Info.plist;
769775
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
770-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
776+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
771777
LD_RUNPATH_SEARCH_PATHS = (
772778
"$(inherited)",
773779
"@executable_path/Frameworks",

SwiftMessages.xcodeproj/xcshareddata/xcschemes/SwiftMessages.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1500"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

SwiftMessages/KeyboardTrackingView.swift

+6-7
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,12 @@ open class KeyboardTrackingView: UIView {
136136
self.didChange(change: change, userInfo: userInfo)
137137
self.delegate?.keyboardTrackingViewDidChange(change: change, userInfo: userInfo)
138138
}
139-
UIView.beginAnimations(nil, context: nil)
140-
UIView.setAnimationDuration(durationNumber.doubleValue)
141-
UIView.setAnimationCurve(UIView.AnimationCurve(rawValue: curveNumber.intValue)!)
142-
UIView.setAnimationBeginsFromCurrentState(true)
143-
self.superview?.layoutIfNeeded()
144-
UIView.commitAnimations()
145-
CATransaction.commit()
139+
let curve = UIView.AnimationCurve(rawValue: curveNumber.intValue) ?? .easeInOut
140+
let animation = UIViewPropertyAnimator(duration: durationNumber.doubleValue, curve: curve) {
141+
self.updateConstraintsIfNeeded()
142+
self.superview?.layoutIfNeeded()
143+
}
144+
animation.startAnimation()
146145
}
147146
}
148147

SwiftMessages/Presenter.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ protocol PresenterDelegate: AnimationDelegate {
1212
func hide(presenter: Presenter)
1313
}
1414

15+
@MainActor
1516
class Presenter: NSObject {
1617

1718
// MARK: - API
@@ -77,6 +78,7 @@ class Presenter: NSObject {
7778

7879
// MARK: - Constants
7980

81+
@MainActor
8082
enum PresentationContext {
8183
case viewController(_: Weak<UIViewController>)
8284
case view(_: Weak<UIView>)

SwiftMessages/SwiftMessageModifier.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private struct SwiftMessageModifier<Message>: ViewModifier where Message: Messag
4747
content
4848
.onChange(of: message) { _ in
4949
if let message {
50-
let show: (SwiftMessages.Config, UIView) -> Void = swiftMessages?.show(config:view:) ?? SwiftMessages.show(config:view:)
50+
let show: @MainActor (SwiftMessages.Config, UIView) -> Void = swiftMessages?.show(config:view:) ?? SwiftMessages.show(config:view:)
5151
let view = MessageHostingView(message: message)
5252
var config = config ?? swiftMessages?.defaultConfig ?? SwiftMessages.defaultConfig
5353
config.eventListeners.append { event in

0 commit comments

Comments
 (0)