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 3721c1d..3763ff9 100644
--- a/Example/Pods/Pods.xcodeproj/project.pbxproj
+++ b/Example/Pods/Pods.xcodeproj/project.pbxproj
@@ -356,6 +356,7 @@
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 = "";
@@ -559,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 = "";
@@ -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 = "";
@@ -680,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 = "";
@@ -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;
};
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.podspec b/HTagView.podspec
index d020471..fd5225e 100644
--- a/HTagView.podspec
+++ b/HTagView.podspec
@@ -8,7 +8,8 @@
Pod::Spec.new do |s|
s.name = "HTagView"
- s.version = "3.0.1"
+ 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.
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..9abe039 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
@@ -292,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
}
@@ -327,13 +337,17 @@ 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{
- 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 )
}
}