Skip to content
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

#6 macOS Support #25

Merged
merged 1 commit into from
Mar 9, 2017
Merged
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
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ before_install:
- xcrun instruments -w "iPhone 5 (9.3)" || echo "(Pre)Launched the simulator."
script:
- set -o pipefail && xcodebuild test -project Down.xcodeproj -scheme "Down-iOS" -destination "platform=iOS Simulator,name=iPhone 5,OS=9.3" -enableCodeCoverage YES ONLY_ACTIVE_ARCH=YES | xcpretty -c
- set -o pipefail && xcodebuild -project Down.xcodeproj -scheme "DownTests-macOS" -sdk macosx -destination 'platform=OS X,arch=x86_64' test | xcpretty -c
after_success:
- slather coverage --ignore "../**/*/Xcode*" --ignore "Source/cmark/*" --scheme "Down-iOS" Down.xcodeproj
- slather coverage --ignore "../**/*/Xcode*" --ignore "Source/cmark/*" --scheme "Down-macOS" Down.xcodeproj
3 changes: 3 additions & 0 deletions Down.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ Pod::Spec.new do |spec|
spec.source = { :git => "https://github.com/iwasrobbed/Down.git", :tag => "v" + spec.version.to_s }
spec.source_files = "Source/{cmark,Enums & Options,Extensions,Renderers}/**", "Source/*"
spec.ios.source_files = "Source/Views/**"
spec.osx.source_files = "Source/Views/**"
spec.public_header_files = "Source/*.h"
spec.ios.deployment_target = "8.0"
spec.tvos.deployment_target = "9.0"
spec.osx.deployment_target = "10.11"
spec.requires_arc = true
spec.module_name = "Down"
spec.preserve_path = 'Source/cmark/module.modulemap'
spec.pod_target_xcconfig = { 'SWIFT_INCLUDE_PATHS' => '$(SRCROOT)/Down/Source/cmark/**' }
spec.ios.resource = 'Resources/DownView.bundle'
spec.osx.resource = 'Resources/DownView.bundle'
end
387 changes: 386 additions & 1 deletion Down.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Down.xcodeproj/xcshareddata/xcschemes/Down-iOS.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D4201E7F1CFA5151008EEC6E"
BuildableName = "Down-iOS.framework"
BuildableName = "Down.framework"
BlueprintName = "Down-iOS"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -43,7 +43,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D4201E7F1CFA5151008EEC6E"
BuildableName = "Down-iOS.framework"
BuildableName = "Down.framework"
BlueprintName = "Down-iOS"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
Expand All @@ -65,7 +65,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D4201E7F1CFA5151008EEC6E"
BuildableName = "Down-iOS.framework"
BuildableName = "Down.framework"
BlueprintName = "Down-iOS"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
Expand All @@ -83,7 +83,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D4201E7F1CFA5151008EEC6E"
BuildableName = "Down-iOS.framework"
BuildableName = "Down.framework"
BlueprintName = "Down-iOS"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
Expand Down
99 changes: 99 additions & 0 deletions Down.xcodeproj/xcshareddata/xcschemes/Down-macOS.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8A569F3F1E6B3E50008BE2AC"
BuildableName = "Down.framework"
BlueprintName = "Down"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D4201E891CFA5151008EEC6E"
BuildableName = "DownTests.xctest"
BlueprintName = "DownTests"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8A569F3F1E6B3E50008BE2AC"
BuildableName = "Down.framework"
BlueprintName = "Down"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8A569F3F1E6B3E50008BE2AC"
BuildableName = "Down.framework"
BlueprintName = "Down"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8A569F3F1E6B3E50008BE2AC"
BuildableName = "Down.framework"
BlueprintName = "Down"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
6 changes: 3 additions & 3 deletions Down.xcodeproj/xcshareddata/xcschemes/Down-tvOS.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "24F833A91E62706000590E90"
BuildableName = "Down-tvOS.framework"
BuildableName = "Down.framework"
BlueprintName = "Down-tvOS"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -46,7 +46,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "24F833A91E62706000590E90"
BuildableName = "Down-tvOS.framework"
BuildableName = "Down.framework"
BlueprintName = "Down-tvOS"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
Expand All @@ -64,7 +64,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "24F833A91E62706000590E90"
BuildableName = "Down-tvOS.framework"
BuildableName = "Down.framework"
BlueprintName = "Down-tvOS"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
Expand Down
56 changes: 56 additions & 0 deletions Down.xcodeproj/xcshareddata/xcschemes/DownTests-macOS.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8AFAEAFA1E6E32E900E09B68"
BuildableName = "DownTests-macOS.xctest"
BlueprintName = "DownTests-macOS"
ReferencedContainer = "container:Down.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
19 changes: 19 additions & 0 deletions Down/Down.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// Down.h
// Down
//
// Created by Keaton Burleson on 3/4/17.
// Copyright © 2017 Glazed Donut, LLC. All rights reserved.
//

#import <Cocoa/Cocoa.h>

//! Project version number for Down.
FOUNDATION_EXPORT double DownVersionNumber;

//! Project version string for Down.
FOUNDATION_EXPORT const unsigned char DownVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <Down/PublicHeader.h>


26 changes: 26 additions & 0 deletions Down/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Glazed Donut, LLC. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
7 changes: 6 additions & 1 deletion Source/Extensions/NSAttributedString+HTML.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
// Copyright © 2016 Glazed Donut, LLC. All rights reserved.
//

import UIKit
#if os(OSX)
import AppKit
#else
import UIKit
#endif


extension NSAttributedString {

Expand Down
6 changes: 5 additions & 1 deletion Source/Views/DownView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ extension DownView: WKNavigationDelegate {
switch navigationAction.navigationType {
case .linkActivated:
decisionHandler(.cancel)
UIApplication.shared.openURL(url)
#if os(iOS)
UIApplication.shared.openURL(url)
#elseif os(OSX)
NSWorkspace.shared().open(url)
#endif
default:
decisionHandler(.allow)
}
Expand Down