From 782ec788ae34553bf6b104be0b8a91d1a940b29d Mon Sep 17 00:00:00 2001 From: FutureSonic Date: Mon, 15 Feb 2021 11:09:14 +0000 Subject: [PATCH 1/4] fix calculation of arc for drawBubbleRightShape --- Sources/EasyTipView/EasyTipView.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/EasyTipView/EasyTipView.swift b/Sources/EasyTipView/EasyTipView.swift index 3d3e1bed..dfd5cffa 100644 --- a/Sources/EasyTipView/EasyTipView.swift +++ b/Sources/EasyTipView/EasyTipView.swift @@ -616,8 +616,7 @@ open class EasyTipView: UIView { path.addArc(tangent1End: CGPoint(x: frame.x + frame.width, y: frame.y), tangent2End: CGPoint(x: frame.x, y: frame.y), radius: cornerRadius) path.addArc(tangent1End: CGPoint(x: frame.x, y: frame.y), tangent2End: CGPoint(x: frame.x, y: frame.y + frame.height), radius: cornerRadius) path.addArc(tangent1End: CGPoint(x: frame.x, y: frame.y + frame.height), tangent2End: CGPoint(x: frame.x + frame.width, y: frame.y + frame.height), radius: cornerRadius) - path.addArc(tangent1End: CGPoint(x: frame.x + frame.width, y: frame.y + frame.height), tangent2End: CGPoint(x: frame.x + frame.width, y: frame.height), radius: cornerRadius) - + path.addArc(tangent1End: CGPoint(x: frame.x + frame.width, y: frame.y + frame.height), tangent2End: CGPoint(x: frame.x + frame.width, y: frame.y), radius: cornerRadius) } fileprivate func drawBubbleLeftShape(_ frame: CGRect, cornerRadius: CGFloat, path: CGMutablePath) { From fb2bd0c9105c9d8d5373c26017877df07a372f65 Mon Sep 17 00:00:00 2001 From: Chris McIntyre Date: Fri, 5 Mar 2021 15:24:19 -0600 Subject: [PATCH 2/4] fix misplaced view for pre-iOS 12 devices --- Sources/EasyTipView/EasyTipView.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/EasyTipView/EasyTipView.swift b/Sources/EasyTipView/EasyTipView.swift index dfd5cffa..41347e90 100644 --- a/Sources/EasyTipView/EasyTipView.swift +++ b/Sources/EasyTipView/EasyTipView.swift @@ -533,7 +533,13 @@ open class EasyTipView: UIView { } if case .view(let contentView) = content { - contentView.translatesAutoresizingMaskIntoConstraints = false + // When using `.view(contentView)`, pre-iOS 12 devices will have displaced text (outside of the "bubble"). + // This ensures the view is within the bubble frame + if UIDevice.current.systemVersion.compare("12.0", options: String.CompareOptions.numeric) == ComparisonResult.orderedAscending { + contentView.translatesAutoresizingMaskIntoConstraints = true + } else { + contentView.translatesAutoresizingMaskIntoConstraints = false + } contentView.frame = getContentRect(from: getBubbleFrame()) } From f35fb38f1f98209dabc6da81723750961514012d Mon Sep 17 00:00:00 2001 From: Chris McIntyre Date: Wed, 1 Mar 2023 15:10:28 -0600 Subject: [PATCH 3/4] Fixing Xcode 14 compiler warnings and optimizations --- EasyTipView.xcodeproj/project.pbxproj | 4 ++-- Sources/EasyTipView/EasyTipView.swift | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/EasyTipView.xcodeproj/project.pbxproj b/EasyTipView.xcodeproj/project.pbxproj index e2c1abd5..0c273640 100644 --- a/EasyTipView.xcodeproj/project.pbxproj +++ b/EasyTipView.xcodeproj/project.pbxproj @@ -371,7 +371,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Sources/EasyTipView/info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teodorpatras.EasyTipView; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -394,7 +394,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Sources/EasyTipView/info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teodorpatras.EasyTipView; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Sources/EasyTipView/EasyTipView.swift b/Sources/EasyTipView/EasyTipView.swift index 41347e90..bce57781 100644 --- a/Sources/EasyTipView/EasyTipView.swift +++ b/Sources/EasyTipView/EasyTipView.swift @@ -24,7 +24,7 @@ #if canImport(UIKit) import UIKit -public protocol EasyTipViewDelegate : class { +public protocol EasyTipViewDelegate : AnyObject { func easyTipViewDidTap(_ tipView: EasyTipView) func easyTipViewDidDismiss(_ tipView : EasyTipView) } @@ -142,11 +142,17 @@ public extension EasyTipView { func show(animated: Bool = true, forView view: UIView, withinSuperview superview: UIView? = nil) { #if TARGET_APP_EXTENSIONS - precondition(superview != nil, "The supplied superview parameter cannot be nil for app extensions.") + guard let strongSuperview = superview else { + debugPrint("The supplied superview parameter cannot be nil for app extensions.") + return + } - let superview = superview! + let superview = strongSuperview #else - precondition(superview == nil || view.hasSuperview(superview!), "The supplied superview <\(superview!)> is not a direct nor an indirect superview of the supplied reference view <\(view)>. The superview passed to this method should be a direct or an indirect superview of the reference view. To display the tooltip within the main window, ignore the superview parameter.") + guard superview == nil || view.hasSuperview(superview!) else { + debugPrint("The supplied superview <\(String(describing: superview))> is not a direct nor an indirect superview of the supplied reference view <\(String(describing: view))>. The superview passed to this method should be a direct or an indirect superview of the reference view. To display the tooltip within the main window, ignore the superview parameter.") + return + } let superview = superview ?? UIApplication.shared.windows.first! #endif @@ -540,7 +546,14 @@ open class EasyTipView: UIView { } else { contentView.translatesAutoresizingMaskIntoConstraints = false } - contentView.frame = getContentRect(from: getBubbleFrame()) + + DispatchQueue.main.async { [weak self] in + guard let strongSelf = self else { + return + } + + contentView.frame = strongSelf.getContentRect(from: strongSelf.getBubbleFrame()) + } } self.frame = frame From 1c51ff0e942d391e03b2006b5f3febb881a20278 Mon Sep 17 00:00:00 2001 From: Chris McIntyre Date: Thu, 2 Mar 2023 12:29:47 -0600 Subject: [PATCH 4/4] updated settings --- EasyTipView.xcodeproj/project.pbxproj | 18 +++++++------- .../xcschemes/EasyTipView.xcscheme | 24 ++++++++----------- .../xcshareddata/WorkspaceSettings.xcsettings | 8 +++++++ .../xcschemes/EasyTipView-Example.xcscheme | 24 ++++++++----------- 4 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 EasyTipView.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/EasyTipView.xcodeproj/project.pbxproj b/EasyTipView.xcodeproj/project.pbxproj index 0c273640..760e3917 100644 --- a/EasyTipView.xcodeproj/project.pbxproj +++ b/EasyTipView.xcodeproj/project.pbxproj @@ -165,7 +165,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1420; ORGANIZATIONNAME = teodorpatras; TargetAttributes = { 1310EC8A1D0C537F0000E71E = { @@ -268,6 +268,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -293,7 +294,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -328,6 +329,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -347,7 +349,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -362,8 +364,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_IDENTITY = ""; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -371,7 +372,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Sources/EasyTipView/info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teodorpatras.EasyTipView; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -385,8 +386,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_IDENTITY = ""; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -394,7 +394,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Sources/EasyTipView/info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teodorpatras.EasyTipView; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/EasyTipView.xcodeproj/xcshareddata/xcschemes/EasyTipView.xcscheme b/EasyTipView.xcodeproj/xcshareddata/xcschemes/EasyTipView.xcscheme index 6c7d41ce..33d59b95 100644 --- a/EasyTipView.xcodeproj/xcshareddata/xcschemes/EasyTipView.xcscheme +++ b/EasyTipView.xcodeproj/xcshareddata/xcschemes/EasyTipView.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -39,17 +48,6 @@ - - - - - - - - + + + + PreviewsEnabled + + + diff --git a/Example/EasyTipView-Example.xcodeproj/xcshareddata/xcschemes/EasyTipView-Example.xcscheme b/Example/EasyTipView-Example.xcodeproj/xcshareddata/xcschemes/EasyTipView-Example.xcscheme index ed46441f..e74230c0 100644 --- a/Example/EasyTipView-Example.xcodeproj/xcshareddata/xcschemes/EasyTipView-Example.xcscheme +++ b/Example/EasyTipView-Example.xcodeproj/xcshareddata/xcschemes/EasyTipView-Example.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -53,17 +62,6 @@ - - - - - - - -