Skip to content

Swift support #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions NSAttributedStringFormat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

/* Begin PBXBuildFile section */
279E6DC21BB8855B0043DDC9 /* NSAttributedStringFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 279E6DC11BB8855B0043DDC9 /* NSAttributedStringFormat.h */; settings = {ATTRIBUTES = (Public, ); }; };
279E6DC91BB8855B0043DDC9 /* NSAttributedStringFormat.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 279E6DBE1BB8855B0043DDC9 /* NSAttributedStringFormat.framework */; settings = {ASSET_TAGS = (); }; };
279E6DD91BB8857A0043DDC9 /* NSAttributedString+CCLFormatTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 279E6DD81BB8857A0043DDC9 /* NSAttributedString+CCLFormatTests.m */; settings = {ASSET_TAGS = (); }; };
279E6DDB1BB885AF0043DDC9 /* NSAttributedString+CCLFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 279E6DDA1BB885AF0043DDC9 /* NSAttributedString+CCLFormat.m */; settings = {ASSET_TAGS = (); }; };
279E6DC91BB8855B0043DDC9 /* NSAttributedStringFormat.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 279E6DBE1BB8855B0043DDC9 /* NSAttributedStringFormat.framework */; };
279E6DD91BB8857A0043DDC9 /* NSAttributedString+CCLFormatTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 279E6DD81BB8857A0043DDC9 /* NSAttributedString+CCLFormatTests.m */; };
279E6DDB1BB885AF0043DDC9 /* NSAttributedString+CCLFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 279E6DDA1BB885AF0043DDC9 /* NSAttributedString+CCLFormat.m */; };
279E6DDD1BB885BF0043DDC9 /* NSAttributedString+CCLFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 279E6DDC1BB885BF0043DDC9 /* NSAttributedString+CCLFormat.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -165,11 +165,12 @@
279E6DB51BB8855B0043DDC9 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Cocode;
TargetAttributes = {
279E6DBD1BB8855B0043DDC9 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0830;
};
279E6DC71BB8855B0043DDC9 = {
CreatedOnToolsVersion = 7.0;
Expand Down Expand Up @@ -247,13 +248,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
Expand All @@ -275,10 +284,9 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -292,13 +300,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
Expand All @@ -314,9 +330,9 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -326,6 +342,8 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 279E6DE21BB8A4CB0043DDC9 /* UniversalFramework_Framework.xcconfig */;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -338,13 +356,17 @@
PRODUCT_BUNDLE_IDENTIFIER = org.cocode.NSAttributedStringFormat;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
279E6DD41BB8855B0043DDC9 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 279E6DE21BB8A4CB0043DDC9 /* UniversalFramework_Framework.xcconfig */;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -357,6 +379,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.cocode.NSAttributedStringFormat;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
12 changes: 8 additions & 4 deletions NSAttributedStringFormat/NSAttributedString+CCLFormat.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/** Attributed string extension for creating attributed strings from a format string. */
@interface NSAttributedString (CCLFormat)

Expand All @@ -16,7 +18,7 @@
@param arguments list of arguments to substitute into format.
@return An attributed string created by using format as a template into which the remaining argument values are substituted.
*/
+ (instancetype)attributedStringWithAttributes:(NSDictionary *)attributes format:(NSString *)format, ... NS_FORMAT_FUNCTION(2,3);
+ (instancetype)attributedStringWithAttributes:(nullable id)attributes format:(NSString *)format, ... NS_FORMAT_FUNCTION(2,3);

/** Returns an attributed string created by using a given format string as a template into which the remaining argument values are substituted.
@param format A format string. This value must not be nil.
Expand All @@ -31,7 +33,7 @@
@param arguments list of arguments to substitute into format.
@return An attributed string created by using format as a template into which the remaining argument values are substituted.
*/
+ (instancetype)attributedStringWithAttributes:(NSDictionary *)attributes format:(NSString *)format arguments:(va_list)arguments NS_FORMAT_FUNCTION(2,0);
+ (instancetype)attributedStringWithAttributes:(nullable id)attributes format:(NSString *)format arguments:(va_list)arguments NS_FORMAT_FUNCTION(2,0);

/** Returns an attributed string created by using a given format string as a template into which the remaining argument values are substituted.
@param format A format string. This value must not be nil.
Expand All @@ -46,7 +48,7 @@
@param ... A comma-separated list of arguments to substitute into format.
@return An attributed string created by using format as a template into which the remaining argument values are substituted.
*/
- (instancetype)initWithAttributes:(NSDictionary *)attributes format:(NSString *)format, ... NS_FORMAT_FUNCTION(2,3);
- (instancetype)initWithAttributes:(nullable id)attributes format:(NSString *)format, ... NS_FORMAT_FUNCTION(2,3);

/** Returns an attributed string created by using a given format string as a template into which the remaining argument values are substituted.
@param format A format string. This value must not be nil.
Expand All @@ -61,7 +63,9 @@
@param arguments list of arguments to substitute into format.
@return An attributed string created by using format as a template into which the remaining argument values are substituted.
*/
- (instancetype)initWithAttributes:(NSDictionary *)attributes format:(NSString *)format arguments:(va_list)arguments NS_FORMAT_FUNCTION(2,0);
- (instancetype)initWithAttributes:(nullable id)attributes format:(NSString *)format arguments:(va_list)arguments NS_FORMAT_FUNCTION(2,0);


@end

NS_ASSUME_NONNULL_END