add osx support back

This commit is contained in:
Alfred Gao 2017-10-30 21:37:05 +08:00
parent 7863e3b7f7
commit 3ad7aa5705
4 changed files with 40 additions and 14 deletions

View File

@ -7,6 +7,9 @@ a pod to convert String to NSAttributedString
[![License](https://img.shields.io/cocoapods/l/TextFormater.svg?style=flat)](http://cocoapods.org/pods/TextFormater)
[![Platform](https://img.shields.io/cocoapods/p/TextFormater.svg?style=flat)](http://cocoapods.org/pods/TextFormater)
* Add OSX support back
## 1.4.0
* Support Swift 4 (on ios only)

View File

@ -115,7 +115,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Alfred Gao";
TargetAttributes = {
3AB3DACB1E1D222B00FD5208 = {
@ -161,13 +161,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-ExampleOSX-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
9D4B442497C7321CC389E748 /* [CP] Embed Pods Frameworks */ = {
@ -176,9 +179,12 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-ExampleOSX/Pods-ExampleOSX-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/TextFormater/TextFormater.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TextFormater.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
@ -235,7 +241,9 @@
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_DOCUMENTATION_COMMENTS = YES;
@ -243,7 +251,11 @@
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;
@ -272,6 +284,7 @@
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
};
name = Debug;
};
@ -284,7 +297,9 @@
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_DOCUMENTATION_COMMENTS = YES;
@ -292,7 +307,11 @@
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;
@ -313,6 +332,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
};
name = Release;
};
@ -324,9 +344,10 @@
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = ExampleOSX/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = org.alfredg.ExampleOSX;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
@ -338,9 +359,10 @@
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = ExampleOSX/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = org.alfredg.ExampleOSX;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
@ -363,6 +385,7 @@
3AB3DADD1E1D222B00FD5208 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};

View File

@ -86,9 +86,9 @@ public class TextFormater : NSObject {
]
#elseif os(OSX)
public private(set) var fonts : [String : String] = [
"normalfont" : NSFont.systemFont(ofSize: NSFont.systemFontSize()).fontName,
"boldfont" : NSFont.boldSystemFont(ofSize: NSFont.systemFontSize()).fontName,
"italicfont" : NSFont.boldSystemFont(ofSize: NSFont.systemFontSize()).fontName,
"normalfont" : NSFont.systemFont(ofSize: NSFont.systemFontSize).fontName,
"boldfont" : NSFont.boldSystemFont(ofSize: NSFont.systemFontSize).fontName,
"italicfont" : NSFont.boldSystemFont(ofSize: NSFont.systemFontSize).fontName,
]
#endif
///
@ -112,7 +112,7 @@ public class TextFormater : NSObject {
#if os(iOS)
public var normalFontSize: CGFloat = UIFont.systemFontSize
#elseif os(OSX)
public var normalFontSize: CGFloat = NSFont.systemFontSize()
public var normalFontSize: CGFloat = NSFont.systemFontSize
#endif
///
///
@ -313,7 +313,7 @@ public class TextFormater : NSObject {
#if os(iOS)
currentfont = UIFont.systemFont(ofSize: UIFont.systemFontSize)
#elseif os(OSX)
currentfont = NSFont.systemFont(ofSize: NSFont.systemFontSize())
currentfont = NSFont.systemFont(ofSize: NSFont.systemFontSize)
#endif
}
let newLineFont = currentfont.withSize(currentfont.pointSize / 2)
@ -399,7 +399,7 @@ public class TextFormater : NSObject {
#if os(iOS)
oldfont = UIFont.systemFont(ofSize: UIFont.systemFontSize)
#elseif os(OSX)
oldfont = UIFont.systemFont(ofSize: UIFont.systemFontSize())
oldfont = UIFont.systemFont(ofSize: UIFont.systemFontSize)
#endif
}
@ -457,7 +457,7 @@ public class TextFormater : NSObject {
#if os(iOS)
let oldfontsize = (lastAttr(in: attrs, with: NSAttributedStringKey.font.rawValue) as? UIFont)?.pointSize ?? UIFont.systemFontSize
#elseif os(OSX)
let oldfontsize = (lastAttr(in: attrs, with: NSFontAttributeName) as? UIFont)?.pointSize ?? UIFont.systemFontSize()
let oldfontsize = (lastAttr(in: attrs, with: NSAttributedStringKey.font.rawValue) as? UIFont)?.pointSize ?? UIFont.systemFontSize
#endif
let newfontname: String
switch _commandName {
@ -513,7 +513,7 @@ public class TextFormater : NSObject {
#if os(iOS)
style.setParagraphStyle(NSParagraphStyle.default)
#elseif os(OSX)
style.setParagraphStyle(NSParagraphStyle.default())
style.setParagraphStyle(NSParagraphStyle.default)
#endif
}

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TextFormater'
s.version = '1.4.0'
s.version = '1.4.1'
s.summary = 'Convert String to NSAttributedString'
s.description = <<-DESC
@ -14,7 +14,7 @@ Convert a short string with formatting commands to attributed string. For used t
s.source = { :git => 'https://github.com/1fr3dg/TextFormater.git', :tag => s.version.to_s }
s.ios.deployment_target = '9.0'
#s.osx.deployment_target = '10.12'
s.osx.deployment_target = '10.12'
s.source_files = 'Sources/*'