From 558c488b4558e2f0b5023120a4fcd2b8dd4e713f Mon Sep 17 00:00:00 2001 From: Avinash Kaul Date: Tue, 6 Aug 2019 23:19:17 +0530 Subject: [PATCH 1/5] Swift 4.2 support --- Example/Pods/Pods.xcodeproj/project.pbxproj | 11 +++++++---- .../contents.xcworkspacedata | 7 +++++++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ HTagView/Classes/HTag.swift | 17 ++++++++++++----- HTagView/Classes/HTagView.swift | 16 +++++++++++++--- 5 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 3721c1d..108b09f 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -351,11 +351,12 @@ LastSwiftUpdateCheck = 0830; LastUpgradeCheck = 0700; }; - buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; + buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "_Pods" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 7DB346D0F39D3F0E887471402A8071AB; @@ -520,7 +521,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -610,6 +611,7 @@ ONLY_ACTIVE_ARCH = YES; PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; + SWIFT_VERSION = 4.2; SYMROOT = "${SRCROOT}/../build"; }; name = Debug; @@ -642,7 +644,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -726,6 +728,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.0; PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; + SWIFT_VERSION = 4.2; SYMROOT = "${SRCROOT}/../build"; VALIDATE_PRODUCT = YES; }; @@ -743,7 +746,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { + 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "_Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( 4E487F173E6C9664F4E9E26B9635D23C /* Debug */, diff --git a/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/HTagView/Classes/HTag.swift b/HTagView/Classes/HTag.swift index 30ba078..057c9fe 100644 --- a/HTagView/Classes/HTag.swift +++ b/HTagView/Classes/HTag.swift @@ -141,7 +141,7 @@ public class HTag: UIView { // MARK: - cancel button func setupCancelButton() { - cancelButton.setImage(UIImage(named: "close_small", in: Bundle(for: self.classForCoder), compatibleWith: nil)?.withRenderingMode(.alwaysTemplate), for: UIControlState()) + cancelButton.setImage(UIImage(named: "close_small", in: Bundle(for: self.classForCoder), compatibleWith: nil)?.withRenderingMode(.alwaysTemplate), for: UIControl.State()) cancelButton.addTarget(self, action: #selector(cancelled), for: .touchUpInside) addSubview(cancelButton) cancelButton.isHidden = tagType == .select @@ -199,9 +199,16 @@ public class HTag: UIView { func updateTitlesColorsAndFontsDueToSelection() { backgroundColor = isSelected ? tagMainBackColor : tagSecondBackColor let textColor = isSelected ? tagMainTextColor : tagSecondTextColor + /* var attributes: [String: Any] = [:] - attributes[NSFontAttributeName] = tagFont - attributes[NSForegroundColorAttributeName] = textColor + //attributes[NSFontAttributeName] = tagFont + attributes[NSAttributedString.Key.font.rawValue] = tagFont + //attributes[NSForegroundColorAttributeName] = textColor + attributes[NSAttributedString.Key.foregroundColor.rawValue] = textColor + */ + var attributes: [NSAttributedString.Key:Any] = [:] + attributes[NSAttributedString.Key.font] = tagFont + attributes[NSAttributedString.Key.foregroundColor] = textColor button.setAttributedTitle(NSAttributedString(string: tagTitle, attributes: attributes), for: .normal) if tagType == .cancel { cancelButton.tintColor = textColor @@ -215,10 +222,10 @@ public class HTag: UIView { } // MARK: - User interaction - func tapped(){ + @objc func tapped(){ delegate?.tagClicked(self) } - func cancelled() { + @objc func cancelled() { delegate?.tagCancelled(self) } } diff --git a/HTagView/Classes/HTagView.swift b/HTagView/Classes/HTagView.swift index ee6dacb..e53129e 100644 --- a/HTagView/Classes/HTagView.swift +++ b/HTagView/Classes/HTagView.swift @@ -91,8 +91,18 @@ open class HTagView: UIView { /** Main background color of tags */ + /* @IBInspectable - open var tagMainBackColor : UIColor = UIColor(colorLiteralRed: 100/255, green: 200/255, blue: 205/255, alpha: 1) { + open var tagMainBackColor1 : UIColor = UIColor(colorLiteralRed: 100/255, green: 200/255, blue: 205/255, alpha: 1) { + didSet { + tags.forEach { + $0.tagMainBackColor = tagMainBackColor1 + } + } + } + */ + @IBInspectable + open var tagMainBackColor : UIColor = UIColor.init(red: 100/255, green: 200/255, blue: 205/255, alpha: 1.0) { didSet { tags.forEach { $0.tagMainBackColor = tagMainBackColor @@ -330,10 +340,10 @@ open class HTagView: UIView { override open var intrinsicContentSize : CGSize { if tags.count == 0{ - return CGSize(width: UIViewNoIntrinsicMetric, height: 0) + return CGSize(width: UIView.noIntrinsicMetric, height: 0) }else{ let height = (tags.last?.frame.origin.y ?? 0) + (tags.last?.frame.height ?? 0) + marg - return CGSize(width: UIViewNoIntrinsicMetric, height: height ) + return CGSize(width: UIView.noIntrinsicMetric, height: height ) } } From 51575b773cce785e820be6ef196350c917e7a58c Mon Sep 17 00:00:00 2001 From: Avinash Kaul Date: Wed, 7 Aug 2019 13:45:44 +0530 Subject: [PATCH 2/5] Updating version to 4.2 --- .swift-version | 2 +- Example/Pods/Pods.xcodeproj/project.pbxproj | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.swift-version b/.swift-version index 9f55b2c..bf77d54 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -3.0 +4.2 diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 108b09f..3763ff9 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -351,7 +351,7 @@ LastSwiftUpdateCheck = 0830; LastUpgradeCheck = 0700; }; - buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "_Pods" */; + buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -560,7 +560,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -682,7 +682,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -746,7 +746,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "_Pods" */ = { + 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( 4E487F173E6C9664F4E9E26B9635D23C /* Debug */, From d3177504e4ad1484290cbeff2270086ff2b4b9c0 Mon Sep 17 00:00:00 2001 From: Avinash Kaul Date: Wed, 7 Aug 2019 13:52:21 +0530 Subject: [PATCH 3/5] Upgraded Version --- HTagView.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HTagView.podspec b/HTagView.podspec index d020471..4ad7ca9 100644 --- a/HTagView.podspec +++ b/HTagView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "HTagView" - s.version = "3.0.1" + s.version = "3.0.2" s.summary = "A customized tag view sublassing UIView" # This description is used to generate tags and improve search results. From 69f07ec434ca2fbbef1083210e072179fe50fbdf Mon Sep 17 00:00:00 2001 From: Avinash Kaul Date: Wed, 7 Aug 2019 14:02:28 +0530 Subject: [PATCH 4/5] Adding s.swift_version to podspec file --- HTagView.podspec | 1 + 1 file changed, 1 insertion(+) diff --git a/HTagView.podspec b/HTagView.podspec index 4ad7ca9..fd5225e 100644 --- a/HTagView.podspec +++ b/HTagView.podspec @@ -9,6 +9,7 @@ Pod::Spec.new do |s| s.name = "HTagView" s.version = "3.0.2" + s.swift_version = '4.2' s.summary = "A customized tag view sublassing UIView" # This description is used to generate tags and improve search results. From 0e2558b00124ca298d543a6a4eee36d13fef627e Mon Sep 17 00:00:00 2001 From: Avinash Kaul Date: Fri, 17 Jan 2020 16:29:42 +0530 Subject: [PATCH 5/5] Changes --- HTagView/Classes/HTagView.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/HTagView/Classes/HTagView.swift b/HTagView/Classes/HTagView.swift index e53129e..9abe039 100644 --- a/HTagView/Classes/HTagView.swift +++ b/HTagView/Classes/HTagView.swift @@ -302,13 +302,13 @@ open class HTagView: UIView { tags.append(tag) } - layoutSubviews() + //layoutSubviews() + resizeTheUIView() invalidateIntrinsicContentSize() } - // MARK: - Subclassing UIView - override open func layoutSubviews() { - guard let dataSource = dataSource else { + func resizeTheUIView(){ + guard let dataSource = dataSource else { return } @@ -337,6 +337,10 @@ open class HTagView: UIView { self.frame.size = CGSize(width: self.frame.width, height: y + (tags.last?.frame.height ?? 0) + marg ) } } + // MARK: - Subclassing UIView + override open func layoutSubviews() { + print("HTagView resizeTheUIView ") + } override open var intrinsicContentSize : CGSize { if tags.count == 0{