Skip to content

Commit 437f6b8

Browse files
committed
Updated for Swift 3.0 and Xcode 8
1 parent b442e8c commit 437f6b8

File tree

8 files changed

+43
-27
lines changed

8 files changed

+43
-27
lines changed

Cartfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "njdehoog/hoedown" == 3.0.2
1+
github "njdehoog/hoedown" "3.0.2-swift3.0"

Cartfile.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "njdehoog/hoedown" "2a5eedf60b5a4fc63ac599cf35a78fa3ca2250d9"
1+
github "njdehoog/hoedown" "3.0.2-swift3.0"

SwiftHoedown.xcodeproj/project.pbxproj

+29-13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
FD24971E1D914223003897A8 /* Hoedown.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDFEB1181BA7153800AE7544 /* Hoedown.framework */; };
11+
FD24971F1D91422D003897A8 /* Hoedown.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDEDAFC91BA462280016BFD3 /* Hoedown.framework */; };
12+
FD2497201D914579003897A8 /* Hoedown.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDFEB1181BA7153800AE7544 /* Hoedown.framework */; };
1013
FD3DFCF61BA81162008358E1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD3DFCF51BA81162008358E1 /* AppDelegate.swift */; };
1114
FD3DFCF81BA81162008358E1 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD3DFCF71BA81162008358E1 /* WebViewController.swift */; };
1215
FD3DFCFD1BA81162008358E1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FD3DFCFC1BA81162008358E1 /* Assets.xcassets */; };
@@ -18,16 +21,12 @@
1821
FD9515C51BA70FFD0064D496 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9515C41BA70FFD0064D496 /* ViewController.swift */; };
1922
FD9515C71BA70FFD0064D496 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FD9515C61BA70FFD0064D496 /* Assets.xcassets */; };
2023
FD9515CA1BA70FFD0064D496 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FD9515C81BA70FFD0064D496 /* Main.storyboard */; };
21-
FDA1F0FD1AF8F6770037168C /* Hoedown.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA1F0FC1AF8F6770037168C /* Hoedown.framework */; };
2224
FDAA92131BD8D4770070B651 /* SwiftHoedownTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDAA92121BD8D4770070B651 /* SwiftHoedownTests.swift */; };
2325
FDAA92151BD8D4770070B651 /* SwiftHoedown.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDD6820D1AF7E38F00C2B1DF /* SwiftHoedown.framework */; };
24-
FDAA921B1BD8D5020070B651 /* Hoedown.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDFEB1181BA7153800AE7544 /* Hoedown.framework */; };
25-
FDAA921D1BD8D6890070B651 /* Hoedown.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = FDA1F0FC1AF8F6770037168C /* Hoedown.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
2626
FDD682131AF7E38F00C2B1DF /* SwiftHoedown.h in Headers */ = {isa = PBXBuildFile; fileRef = FDD682121AF7E38F00C2B1DF /* SwiftHoedown.h */; settings = {ATTRIBUTES = (Public, ); }; };
2727
FDD6822C1AF7E44900C2B1DF /* Hoedown.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD6822B1AF7E44900C2B1DF /* Hoedown.swift */; };
2828
FDEDAFA51BA45FD80016BFD3 /* SwiftHoedown.h in Headers */ = {isa = PBXBuildFile; fileRef = FDD682121AF7E38F00C2B1DF /* SwiftHoedown.h */; settings = {ATTRIBUTES = (Public, ); }; };
2929
FDEDAFC81BA461920016BFD3 /* Hoedown.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD6822B1AF7E44900C2B1DF /* Hoedown.swift */; };
30-
FDEDAFCA1BA462280016BFD3 /* Hoedown.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDEDAFC91BA462280016BFD3 /* Hoedown.framework */; };
3130
FDFEB1161BA7145900AE7544 /* SwiftHoedown.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDD6820D1AF7E38F00C2B1DF /* SwiftHoedown.framework */; };
3231
FDFEB1191BA7153800AE7544 /* Hoedown.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDFEB1181BA7153800AE7544 /* Hoedown.framework */; };
3332
FDFEB11A1BA7153800AE7544 /* Hoedown.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FDFEB1181BA7153800AE7544 /* Hoedown.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@@ -65,7 +64,6 @@
6564
dstPath = "";
6665
dstSubfolderSpec = 10;
6766
files = (
68-
FDAA921D1BD8D6890070B651 /* Hoedown.framework in CopyFiles */,
6967
);
7068
runOnlyForDeploymentPostprocessing = 0;
7169
};
@@ -95,7 +93,6 @@
9593
FD9515C61BA70FFD0064D496 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
9694
FD9515C91BA70FFD0064D496 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
9795
FD9515CB1BA70FFD0064D496 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
98-
FDA1F0FC1AF8F6770037168C /* Hoedown.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Hoedown.framework; path = Carthage/Build/Mac/Hoedown.framework; sourceTree = SOURCE_ROOT; };
9996
FDAA92101BD8D4770070B651 /* SwiftHoedownTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftHoedownTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
10097
FDAA92121BD8D4770070B651 /* SwiftHoedownTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftHoedownTests.swift; sourceTree = "<group>"; };
10198
FDAA92141BD8D4770070B651 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -132,24 +129,24 @@
132129
isa = PBXFrameworksBuildPhase;
133130
buildActionMask = 2147483647;
134131
files = (
135-
FDAA921B1BD8D5020070B651 /* Hoedown.framework in Frameworks */,
136132
FDAA92151BD8D4770070B651 /* SwiftHoedown.framework in Frameworks */,
133+
FD2497201D914579003897A8 /* Hoedown.framework in Frameworks */,
137134
);
138135
runOnlyForDeploymentPostprocessing = 0;
139136
};
140137
FDD682091AF7E38F00C2B1DF /* Frameworks */ = {
141138
isa = PBXFrameworksBuildPhase;
142139
buildActionMask = 2147483647;
143140
files = (
144-
FDA1F0FD1AF8F6770037168C /* Hoedown.framework in Frameworks */,
141+
FD24971E1D914223003897A8 /* Hoedown.framework in Frameworks */,
145142
);
146143
runOnlyForDeploymentPostprocessing = 0;
147144
};
148145
FDEDAF0A1BA4377F0016BFD3 /* Frameworks */ = {
149146
isa = PBXFrameworksBuildPhase;
150147
buildActionMask = 2147483647;
151148
files = (
152-
FDEDAFCA1BA462280016BFD3 /* Hoedown.framework in Frameworks */,
149+
FD24971F1D91422D003897A8 /* Hoedown.framework in Frameworks */,
153150
);
154151
runOnlyForDeploymentPostprocessing = 0;
155152
};
@@ -236,7 +233,6 @@
236233
FDD682101AF7E38F00C2B1DF /* Supporting Files */ = {
237234
isa = PBXGroup;
238235
children = (
239-
FDA1F0FC1AF8F6770037168C /* Hoedown.framework */,
240236
FDD682111AF7E38F00C2B1DF /* Info.plist */,
241237
);
242238
name = "Supporting Files";
@@ -364,7 +360,7 @@
364360
isa = PBXProject;
365361
attributes = {
366362
LastSwiftUpdateCheck = 0700;
367-
LastUpgradeCheck = 0630;
363+
LastUpgradeCheck = 0800;
368364
ORGANIZATIONNAME = "Invisible Pixel";
369365
TargetAttributes = {
370366
FD3DFCF21BA81162008358E1 = {
@@ -375,9 +371,11 @@
375371
};
376372
FDAA920F1BD8D4770070B651 = {
377373
CreatedOnToolsVersion = 7.0.1;
374+
LastSwiftMigration = 0800;
378375
};
379376
FDD6820C1AF7E38F00C2B1DF = {
380377
CreatedOnToolsVersion = 6.3.1;
378+
LastSwiftMigration = 0800;
381379
};
382380
FDEDAF0D1BA4377F0016BFD3 = {
383381
CreatedOnToolsVersion = 7.0;
@@ -633,9 +631,10 @@
633631
"$(PROJECT_DIR)/Carthage/Build/Mac",
634632
);
635633
INFOPLIST_FILE = SwiftHoedownTests/Info.plist;
636-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
634+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(FRAMEWORK_SEARCH_PATHS)";
637635
PRODUCT_BUNDLE_IDENTIFIER = com.invisiblepixel.SwiftHoedownTests;
638636
PRODUCT_NAME = "$(TARGET_NAME)";
637+
SWIFT_VERSION = 3.0;
639638
};
640639
name = Debug;
641640
};
@@ -648,9 +647,10 @@
648647
"$(PROJECT_DIR)/Carthage/Build/Mac",
649648
);
650649
INFOPLIST_FILE = SwiftHoedownTests/Info.plist;
651-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
650+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(FRAMEWORK_SEARCH_PATHS)";
652651
PRODUCT_BUNDLE_IDENTIFIER = com.invisiblepixel.SwiftHoedownTests;
653652
PRODUCT_NAME = "$(TARGET_NAME)";
653+
SWIFT_VERSION = 3.0;
654654
};
655655
name = Release;
656656
};
@@ -667,15 +667,18 @@
667667
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
668668
CLANG_WARN_EMPTY_BODY = YES;
669669
CLANG_WARN_ENUM_CONVERSION = YES;
670+
CLANG_WARN_INFINITE_RECURSION = YES;
670671
CLANG_WARN_INT_CONVERSION = YES;
671672
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
673+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
672674
CLANG_WARN_UNREACHABLE_CODE = YES;
673675
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
674676
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
675677
COPY_PHASE_STRIP = NO;
676678
CURRENT_PROJECT_VERSION = 1;
677679
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
678680
ENABLE_STRICT_OBJC_MSGSEND = YES;
681+
ENABLE_TESTABILITY = YES;
679682
GCC_C_LANGUAGE_STANDARD = gnu99;
680683
GCC_DYNAMIC_NO_PIC = NO;
681684
GCC_NO_COMMON_BLOCKS = YES;
@@ -716,8 +719,10 @@
716719
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
717720
CLANG_WARN_EMPTY_BODY = YES;
718721
CLANG_WARN_ENUM_CONVERSION = YES;
722+
CLANG_WARN_INFINITE_RECURSION = YES;
719723
CLANG_WARN_INT_CONVERSION = YES;
720724
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
725+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
721726
CLANG_WARN_UNREACHABLE_CODE = YES;
722727
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
723728
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -738,6 +743,7 @@
738743
MACOSX_DEPLOYMENT_TARGET = 10.10;
739744
MTL_ENABLE_DEBUG_INFO = NO;
740745
SDKROOT = macosx;
746+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
741747
TARGETED_DEVICE_FAMILY = "1,2";
742748
VALIDATE_PRODUCT = YES;
743749
VERSIONING_SYSTEM = "apple-generic";
@@ -765,9 +771,11 @@
765771
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
766772
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
767773
MACOSX_DEPLOYMENT_TARGET = 10.10;
774+
PRODUCT_BUNDLE_IDENTIFIER = "com.invisiblepixel.$(PRODUCT_NAME:rfc1034identifier)";
768775
PRODUCT_NAME = SwiftHoedown;
769776
SKIP_INSTALL = YES;
770777
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
778+
SWIFT_VERSION = 3.0;
771779
};
772780
name = Debug;
773781
};
@@ -790,14 +798,17 @@
790798
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
791799
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
792800
MACOSX_DEPLOYMENT_TARGET = 10.10;
801+
PRODUCT_BUNDLE_IDENTIFIER = "com.invisiblepixel.$(PRODUCT_NAME:rfc1034identifier)";
793802
PRODUCT_NAME = SwiftHoedown;
794803
SKIP_INSTALL = YES;
804+
SWIFT_VERSION = 3.0;
795805
};
796806
name = Release;
797807
};
798808
FDEDAF141BA4377F0016BFD3 /* Debug */ = {
799809
isa = XCBuildConfiguration;
800810
buildSettings = {
811+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
801812
DEBUG_INFORMATION_FORMAT = dwarf;
802813
DEFINES_MODULE = YES;
803814
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -807,6 +818,7 @@
807818
FRAMEWORK_SEARCH_PATHS = (
808819
"$(inherited)",
809820
"$(PROJECT_DIR)/Carthage/Build/iOS",
821+
"$(PROJECT_DIR)/Carthage/Build/Mac",
810822
);
811823
INFOPLIST_FILE = "swift-hoedown/Info.plist";
812824
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -816,19 +828,22 @@
816828
PRODUCT_NAME = SwiftHoedown;
817829
SDKROOT = iphoneos;
818830
SKIP_INSTALL = YES;
831+
SWIFT_VERSION = 3.0;
819832
};
820833
name = Debug;
821834
};
822835
FDEDAF151BA4377F0016BFD3 /* Release */ = {
823836
isa = XCBuildConfiguration;
824837
buildSettings = {
838+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
825839
DEFINES_MODULE = YES;
826840
DYLIB_COMPATIBILITY_VERSION = 1;
827841
DYLIB_CURRENT_VERSION = 1;
828842
DYLIB_INSTALL_NAME_BASE = "@rpath";
829843
FRAMEWORK_SEARCH_PATHS = (
830844
"$(inherited)",
831845
"$(PROJECT_DIR)/Carthage/Build/iOS",
846+
"$(PROJECT_DIR)/Carthage/Build/Mac",
832847
);
833848
INFOPLIST_FILE = "swift-hoedown/Info.plist";
834849
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -838,6 +853,7 @@
838853
PRODUCT_NAME = SwiftHoedown;
839854
SDKROOT = iphoneos;
840855
SKIP_INSTALL = YES;
856+
SWIFT_VERSION = 3.0;
841857
};
842858
name = Release;
843859
};

SwiftHoedown.xcodeproj/xcshareddata/xcschemes/SwiftHoedownOSX.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

SwiftHoedown.xcodeproj/xcshareddata/xcschemes/SwiftHoedowniOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

source/Hoedown.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import Foundation
1010
import Hoedown
1111

12-
public class Hoedown {
13-
public class func renderHTMLForMarkdown(string: String, flags: HoedownHTMLFlags = .None, extensions: HoedownExtensions = .None) -> String? {
12+
public final class Hoedown {
13+
public class func renderHTMLForMarkdown(_ string: String, flags: HoedownHTMLFlags = .None, extensions: HoedownExtensions = .None) -> String? {
1414
let renderer = HoedownHTMLRenderer(flags: flags)
1515
let document = HoedownDocument(renderer: renderer, extensions: extensions)
1616
return document.renderMarkdown(string)
@@ -34,18 +34,18 @@ public class HoedownHTMLRenderer: HoedownRenderer {
3434
}
3535

3636
public class HoedownDocument {
37-
let internalDocument: COpaquePointer
37+
let internalDocument: OpaquePointer
3838

3939
public init(renderer: HoedownRenderer, extensions: HoedownExtensions = .None, maxNesting: UInt = 16) {
4040
self.internalDocument = hoedown_document_new(renderer.internalRenderer, hoedown_extensions(extensions.rawValue), Int(maxNesting))
4141
}
4242

43-
public func renderMarkdown(string: String, bufferSize: UInt = 16) -> String? {
43+
public func renderMarkdown(_ string: String, bufferSize: UInt = 16) -> String? {
4444
let buffer = hoedown_buffer_new(Int(bufferSize))
4545
hoedown_document_render(self.internalDocument, buffer, string, string.utf8.count);
4646

47-
let htmlOutput = hoedown_buffer_cstr(buffer)
48-
let output = String.fromCString(htmlOutput)
47+
guard let htmlOutput = hoedown_buffer_cstr(buffer) else { return nil }
48+
let output = String(cString: htmlOutput)
4949

5050
hoedown_buffer_free(buffer)
5151

@@ -57,7 +57,7 @@ public class HoedownDocument {
5757
}
5858
}
5959

60-
public struct HoedownExtensions : OptionSetType {
60+
public struct HoedownExtensions : OptionSet {
6161
public let rawValue: UInt32
6262
public init(rawValue: UInt32) { self.rawValue = rawValue }
6363
init(_ value: hoedown_extensions) { self.rawValue = value.rawValue }
@@ -87,7 +87,7 @@ public struct HoedownExtensions : OptionSetType {
8787
public static let DisableIndentedCode = HoedownExtensions(HOEDOWN_EXT_DISABLE_INDENTED_CODE)
8888
}
8989

90-
public struct HoedownHTMLFlags : OptionSetType {
90+
public struct HoedownHTMLFlags : OptionSet {
9191
public let rawValue: UInt32
9292
public init(rawValue: UInt32) { self.rawValue = rawValue }
9393
init(_ value: hoedown_html_flags) { self.rawValue = value.rawValue }

swift-hoedown/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>CFBundleExecutable</key>
88
<string>$(EXECUTABLE_NAME)</string>
99
<key>CFBundleIdentifier</key>
10-
<string>com.invisiblepixel.$(PRODUCT_NAME:rfc1034identifier)</string>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1111
<key>CFBundleInfoDictionaryVersion</key>
1212
<string>6.0</string>
1313
<key>CFBundleName</key>

0 commit comments

Comments
 (0)