Skip to content

Commit

Permalink
update to swift 5 and fix compilation apploft#72
Browse files Browse the repository at this point in the history
+ also update Xcode recommended settings
  • Loading branch information
kikeenrique committed Mar 7, 2021
1 parent 69643c3 commit 3892d9c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 6 additions & 2 deletions Classes/ExpandableLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ extension ExpandableLabel {
let lineTextWithAddedLink = NSMutableAttributedString(attributedString: lineTextWithLastWordRemoved)
if let ellipsis = self.ellipsis {
lineTextWithAddedLink.append(ellipsis)
lineTextWithAddedLink.append(NSAttributedString(string: " ", attributes: [.font: self.font]))
lineTextWithAddedLink.append(NSAttributedString(string: " ",
attributes: [.font: (self.font ?? UIFont.preferredFont(forTextStyle: .body))]))
}
lineTextWithAddedLink.append(linkName)
let fits = self.textFitsWidth(lineTextWithAddedLink)
Expand Down Expand Up @@ -261,7 +262,8 @@ extension ExpandableLabel {
let linkText = NSMutableAttributedString()
if let ellipsis = self.ellipsis {
linkText.append(ellipsis)
linkText.append(NSAttributedString(string: " ", attributes: [.font: self.font]))
linkText.append(NSAttributedString(string: " ",
attributes: [.font: (self.font ?? UIFont.preferredFont(forTextStyle: .body))]))
}
linkText.append(linkName)

Expand Down Expand Up @@ -546,6 +548,8 @@ extension UILabel {
return 1.0
case .left, .natural, .justified:
return 0.0
@unknown default:
fatalError()
}
}
}
Expand Down
15 changes: 11 additions & 4 deletions ExpandableLabel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
1B0D8A3B1F3AAA50004142A4 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1240;
TargetAttributes = {
1B0D8A431F3AAA50004142A4 = {
CreatedOnToolsVersion = 8.3.3;
Expand All @@ -100,10 +100,11 @@
};
buildConfigurationList = 1B0D8A3E1F3AAA50004142A4 /* Build configuration list for PBXProject "ExpandableLabel" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 1B0D8A3A1F3AAA50004142A4;
productRefGroup = 1B0D8A451F3AAA50004142A4 /* Products */;
Expand Down Expand Up @@ -151,15 +152,18 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
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;
Expand Down Expand Up @@ -211,15 +215,18 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
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;
Expand Down Expand Up @@ -264,7 +271,7 @@
PRODUCT_BUNDLE_IDENTIFIER = de.apploft.ExpandableLabel;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -282,7 +289,7 @@
PRODUCT_BUNDLE_IDENTIFIER = de.apploft.ExpandableLabel;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand All @@ -53,8 +49,6 @@
ReferencedContainer = "container:ExpandableLabel.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down

0 comments on commit 3892d9c

Please sign in to comment.