diff --git a/Example/Paparajote.xcodeproj/project.pbxproj b/Example/Paparajote.xcodeproj/project.pbxproj index b6f5114..902614e 100644 --- a/Example/Paparajote.xcodeproj/project.pbxproj +++ b/Example/Paparajote.xcodeproj/project.pbxproj @@ -7,16 +7,22 @@ objects = { /* Begin PBXBuildFile section */ + 235A87E51D8AF7E800740139 /* Paparajote_macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 235A87E41D8AF7E800740139 /* Paparajote_macOS.swift */; }; 237C17561D76313100CB3B4F /* GitHubProviderSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 237C17551D76313100CB3B4F /* GitHubProviderSpec.swift */; }; 23EA8BE51D675D79008333A4 /* OAuth2ControllerSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EA8BE41D675D79008333A4 /* OAuth2ControllerSpec.swift */; }; 23EA8BEB1D67694D008333A4 /* OAuth2ErrorSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EA8BEA1D67694D008333A4 /* OAuth2ErrorSpec.swift */; }; 23EA8BFF1D6C5A60008333A4 /* OAuth2WebViewDelegateSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EA8BFE1D6C5A60008333A4 /* OAuth2WebViewDelegateSpec.swift */; }; 23EA8C051D6C7474008333A4 /* OAuth2WKNavigationDelegateSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EA8C041D6C7474008333A4 /* OAuth2WKNavigationDelegateSpec.swift */; }; + 29244A4F5A27F652153C6857 /* Pods_Paparajote_macOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 413BEBEB0CCE8D226D1D2C78 /* Pods_Paparajote_macOS.framework */; }; FF91210E4977A690F75DDA69 /* Pods_Paparajote_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36C7E3B884422DF922B6C8F6 /* Pods_Paparajote_Tests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 235A87E21D8AF7E800740139 /* Paparajote_macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Paparajote_macOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 235A87E41D8AF7E800740139 /* Paparajote_macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Paparajote_macOS.swift; sourceTree = ""; }; + 235A87E61D8AF7E800740139 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 237C17551D76313100CB3B4F /* GitHubProviderSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitHubProviderSpec.swift; sourceTree = ""; }; + 23B1166CE1CCC5B4D4F340D6 /* Pods-Paparajote_macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Paparajote_macOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Paparajote_macOS/Pods-Paparajote_macOS.debug.xcconfig"; sourceTree = ""; }; 23EA8BE41D675D79008333A4 /* OAuth2ControllerSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OAuth2ControllerSpec.swift; sourceTree = ""; }; 23EA8BEA1D67694D008333A4 /* OAuth2ErrorSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OAuth2ErrorSpec.swift; sourceTree = ""; }; 23EA8BFE1D6C5A60008333A4 /* OAuth2WebViewDelegateSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OAuth2WebViewDelegateSpec.swift; sourceTree = ""; }; @@ -24,14 +30,24 @@ 2856B471986EBD483B09EB81 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 3077F4BECA6E58609BEDFB77 /* Pods-Paparajote_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Paparajote_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Paparajote_Tests/Pods-Paparajote_Tests.debug.xcconfig"; sourceTree = ""; }; 36C7E3B884422DF922B6C8F6 /* Pods_Paparajote_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Paparajote_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 413BEBEB0CCE8D226D1D2C78 /* Pods_Paparajote_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Paparajote_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4BA02AA888D109882BD88294 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 607FACE51AFB9204008FA782 /* Paparajote_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Paparajote_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 660A2347BE8E89D829685393 /* Paparajote.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Paparajote.podspec; path = ../Paparajote.podspec; sourceTree = ""; }; + AC8F2000FD3DC92D43A4CBB4 /* Pods-Paparajote_macOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Paparajote_macOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-Paparajote_macOS/Pods-Paparajote_macOS.release.xcconfig"; sourceTree = ""; }; EE4CDA25CD3DE9F2FE800483 /* Pods-Paparajote_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Paparajote_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Paparajote_Tests/Pods-Paparajote_Tests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 235A87DF1D8AF7E800740139 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 29244A4F5A27F652153C6857 /* Pods_Paparajote_macOS.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 607FACE21AFB9204008FA782 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -43,6 +59,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 235A87E31D8AF7E800740139 /* Paparajote_macOS */ = { + isa = PBXGroup; + children = ( + 235A87E41D8AF7E800740139 /* Paparajote_macOS.swift */, + 235A87E61D8AF7E800740139 /* Info.plist */, + ); + path = Paparajote_macOS; + sourceTree = ""; + }; 237C17541D76312000CB3B4F /* Providers */ = { isa = PBXGroup; children = ( @@ -89,6 +114,8 @@ children = ( 3077F4BECA6E58609BEDFB77 /* Pods-Paparajote_Tests.debug.xcconfig */, EE4CDA25CD3DE9F2FE800483 /* Pods-Paparajote_Tests.release.xcconfig */, + 23B1166CE1CCC5B4D4F340D6 /* Pods-Paparajote_macOS.debug.xcconfig */, + AC8F2000FD3DC92D43A4CBB4 /* Pods-Paparajote_macOS.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -98,6 +125,7 @@ children = ( 607FACF51AFB993E008FA782 /* Podspec Metadata */, 607FACE81AFB9204008FA782 /* Tests */, + 235A87E31D8AF7E800740139 /* Paparajote_macOS */, 607FACD11AFB9204008FA782 /* Products */, 3B6B293F3512B2558381288D /* Pods */, ABFF489E15823DF5E41D3C9B /* Frameworks */, @@ -108,6 +136,7 @@ isa = PBXGroup; children = ( 607FACE51AFB9204008FA782 /* Paparajote_Tests.xctest */, + 235A87E21D8AF7E800740139 /* Paparajote_macOS.xctest */, ); name = Products; sourceTree = ""; @@ -146,6 +175,7 @@ isa = PBXGroup; children = ( 36C7E3B884422DF922B6C8F6 /* Pods_Paparajote_Tests.framework */, + 413BEBEB0CCE8D226D1D2C78 /* Pods_Paparajote_macOS.framework */, ); name = Frameworks; sourceTree = ""; @@ -153,6 +183,26 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 235A87E11D8AF7E800740139 /* Paparajote_macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 235A87E91D8AF7E800740139 /* Build configuration list for PBXNativeTarget "Paparajote_macOS" */; + buildPhases = ( + C470321A23607A9FEB847C3D /* [CP] Check Pods Manifest.lock */, + 235A87DE1D8AF7E800740139 /* Sources */, + 235A87DF1D8AF7E800740139 /* Frameworks */, + 235A87E01D8AF7E800740139 /* Resources */, + D1B54976AD66F3B154496658 /* [CP] Embed Pods Frameworks */, + 9B682128742FC7E92548EDDA /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Paparajote_macOS; + productName = Paparajote_macOS; + productReference = 235A87E21D8AF7E800740139 /* Paparajote_macOS.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 607FACE41AFB9204008FA782 /* Paparajote_Tests */ = { isa = PBXNativeTarget; buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "Paparajote_Tests" */; @@ -184,6 +234,9 @@ LastUpgradeCheck = 0720; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { + 235A87E11D8AF7E800740139 = { + CreatedOnToolsVersion = 7.3.1; + }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; TestTargetID = 607FACCF1AFB9204008FA782; @@ -204,11 +257,19 @@ projectRoot = ""; targets = ( 607FACE41AFB9204008FA782 /* Paparajote_Tests */, + 235A87E11D8AF7E800740139 /* Paparajote_macOS */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 235A87E01D8AF7E800740139 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 607FACE31AFB9204008FA782 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -248,6 +309,51 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; + 9B682128742FC7E92548EDDA /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Paparajote_macOS/Pods-Paparajote_macOS-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + C470321A23607A9FEB847C3D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + D1B54976AD66F3B154496658 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Paparajote_macOS/Pods-Paparajote_macOS-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; D3411E6C6996EB9896960C6C /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -281,6 +387,14 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 235A87DE1D8AF7E800740139 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 235A87E51D8AF7E800740139 /* Paparajote_macOS.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 607FACE11AFB9204008FA782 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -296,6 +410,39 @@ /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ + 235A87E71D8AF7E800740139 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 23B1166CE1CCC5B4D4F340D6 /* Pods-Paparajote_macOS.debug.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + INFOPLIST_FILE = Paparajote_macOS/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + PRODUCT_BUNDLE_IDENTIFIER = "io.caramba.Paparajote-macOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + }; + name = Debug; + }; + 235A87E81D8AF7E800740139 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AC8F2000FD3DC92D43A4CBB4 /* Pods-Paparajote_macOS.release.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Paparajote_macOS/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + PRODUCT_BUNDLE_IDENTIFIER = "io.caramba.Paparajote-macOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + }; + name = Release; + }; 607FACED1AFB9204008FA782 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -418,6 +565,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 235A87E91D8AF7E800740139 /* Build configuration list for PBXNativeTarget "Paparajote_macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 235A87E71D8AF7E800740139 /* Debug */, + 235A87E81D8AF7E800740139 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "Paparajote" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Example/Paparajote.xcodeproj/xcshareddata/xcschemes/Paparajote-Example.xcscheme b/Example/Paparajote.xcodeproj/xcshareddata/xcschemes/Paparajote.xcscheme similarity index 71% rename from Example/Paparajote.xcodeproj/xcshareddata/xcschemes/Paparajote-Example.xcscheme rename to Example/Paparajote.xcodeproj/xcshareddata/xcschemes/Paparajote.xcscheme index 65f1ae3..98f53cc 100644 --- a/Example/Paparajote.xcodeproj/xcshareddata/xcschemes/Paparajote-Example.xcscheme +++ b/Example/Paparajote.xcodeproj/xcshareddata/xcschemes/Paparajote.xcscheme @@ -6,20 +6,6 @@ parallelizeBuildables = "YES" buildImplicitDependencies = "YES"> - - - - + + + + - - - - @@ -76,16 +63,15 @@ debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES"> - + - + @@ -95,16 +81,15 @@ savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES"> - + - + diff --git a/Example/Paparajote_macOS/Info.plist b/Example/Paparajote_macOS/Info.plist new file mode 100644 index 0000000..ba72822 --- /dev/null +++ b/Example/Paparajote_macOS/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Example/Paparajote_macOS/Paparajote_macOS.swift b/Example/Paparajote_macOS/Paparajote_macOS.swift new file mode 100644 index 0000000..ec7359e --- /dev/null +++ b/Example/Paparajote_macOS/Paparajote_macOS.swift @@ -0,0 +1,35 @@ +// +// Paparajote_macOS.swift +// Paparajote_macOS +// +// Created by Pedro Pinera Buendia on 15/09/16. +// Copyright © 2016 CocoaPods. All rights reserved. +// + +import XCTest + +class Paparajote_macOS: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measureBlock { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/Example/Podfile b/Example/Podfile index 1623650..9adaa04 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -5,3 +5,11 @@ target 'Paparajote_Tests' do pod 'Quick', '~> 0.8' pod 'Nimble', '~> 3.0' end + + +target 'Paparajote_macOS' do + pod 'Paparajote', :path => '../' + + pod 'Quick', '~> 0.8' + pod 'Nimble', '~> 3.0' +end diff --git a/Example/Podfile.lock b/Example/Podfile.lock index a756888..1dde11c 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -20,6 +20,6 @@ SPEC CHECKSUMS: Paparajote: 7c6c5c371dd7b0383c13ca34fcab9bf28b6dadb3 Quick: 13a2a2b19a5d8e3ed4fd0c36ee46597fd77ebf71 -PODFILE CHECKSUM: 3ba96eb1a09777d22d79942dfef9b0de44d5cabf +PODFILE CHECKSUM: 8e5ca4a24d77f3b24b779f0a0423e282ad70e483 COCOAPODS: 1.0.1 diff --git a/Paparajote/Classes/Platforms/iOS/OAuth2WKNavigationDelegate.swift b/Paparajote/Classes/Platforms/OAuth2WKNavigationDelegate.swift similarity index 97% rename from Paparajote/Classes/Platforms/iOS/OAuth2WKNavigationDelegate.swift rename to Paparajote/Classes/Platforms/OAuth2WKNavigationDelegate.swift index b7496a7..f96e72f 100644 --- a/Paparajote/Classes/Platforms/iOS/OAuth2WKNavigationDelegate.swift +++ b/Paparajote/Classes/Platforms/OAuth2WKNavigationDelegate.swift @@ -1,8 +1,9 @@ -#if os(iOS) +#if os(iOS) || os(OSX) import Foundation import WebKit /// WKNavigationDelegate that handles the OAuth2 flow. +@available(OSX 10.10, *) @objc public class OAuth2WKNavigationDelegate: NSObject, WKNavigationDelegate, OAuth2Delegate { // MARK: - Attributes diff --git a/Paparajote/Classes/Platforms/iOS/OAuth2WKWebView.swift b/Paparajote/Classes/Platforms/OAuth2WKWebView.swift similarity index 94% rename from Paparajote/Classes/Platforms/iOS/OAuth2WKWebView.swift rename to Paparajote/Classes/Platforms/OAuth2WKWebView.swift index 3e52775..25fb5e0 100644 --- a/Paparajote/Classes/Platforms/iOS/OAuth2WKWebView.swift +++ b/Paparajote/Classes/Platforms/OAuth2WKWebView.swift @@ -1,10 +1,10 @@ -#if os(iOS) +#if os(iOS) || os(OSX) import Foundation -import UIKit import WebKit /// OAuth2 WKWebView +@available(OSX 10.10, *) public class OAuth2WKWebView: WKWebView { // MARK: - Attributes diff --git a/Paparajote/Classes/Platforms/iOS/OAuth2WebView.swift b/Paparajote/Classes/Platforms/OAuth2WebView.swift similarity index 100% rename from Paparajote/Classes/Platforms/iOS/OAuth2WebView.swift rename to Paparajote/Classes/Platforms/OAuth2WebView.swift diff --git a/Paparajote/Classes/Platforms/iOS/OAuth2WebViewDelegate.swift b/Paparajote/Classes/Platforms/OAuth2WebViewDelegate.swift similarity index 100% rename from Paparajote/Classes/Platforms/iOS/OAuth2WebViewDelegate.swift rename to Paparajote/Classes/Platforms/OAuth2WebViewDelegate.swift diff --git a/Paparajote/Classes/Platforms/iOS/OAuth2SessionCompletion.swift b/Paparajote/Classes/Platforms/Oauth2SessionCompletion.swift similarity index 100% rename from Paparajote/Classes/Platforms/iOS/OAuth2SessionCompletion.swift rename to Paparajote/Classes/Platforms/Oauth2SessionCompletion.swift diff --git a/Paparajote/Classes/Providers/GitHubProvider.swift b/Paparajote/Classes/Providers/GitHubProvider.swift index 49c1c59..3d32e7b 100644 --- a/Paparajote/Classes/Providers/GitHubProvider.swift +++ b/Paparajote/Classes/Providers/GitHubProvider.swift @@ -53,11 +53,11 @@ public struct GitHubProvider: OAuth2Provider { "redirect_uri": self.redirectUri, "state": self.state ]) - var request = NSMutableURLRequest() + let request = NSMutableURLRequest() request.addValue("application/json", forHTTPHeaderField: "Accept") request.HTTPMethod = "POST" request.URL = authenticationUrl - return request.copy() as! NSURLRequest + return request.copy() as? NSURLRequest } } } diff --git a/README.md b/README.md index 611e24d..1468159 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,7 @@ public protocol OAuth2Provider { - **Authentication:** Returns an authentication request if the url contains an authentication token. - **SessionAdapter:** Extracts the session from the authentication response data. -> You can check out the existing providers [here](Paparajote/Classes/Providers) - -### OAuth2 on iOS :iphone: - -#### Using UIWebView +#### Using UIWebView *(iOS only)* If you're using `UIWebView` from `UIKit` you can trigger the OAuth2 with a few simple steps: @@ -54,12 +50,12 @@ If you're using `UIWebView` from `UIKit` you can trigger the OAuth2 with a few s 2. Keep a reference to that delegate from your `ViewController`. -#### Using WKWebView +#### Using WKWebView *(iOS and macOS)* +If you're using `WKWebView` from `WKWebKit` you can trigger the OAuth2 with a few simple steps: -### OAuth2 on macOS :computer: -//TODO - +1. Create an instance of `OAuth2WKNavigationDelegate` passing the provider, the webview, and a completion closure that will be executed once the authentication completes. +2. Keep a reference to that delegate from your `ViewController`. ## About diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 3b3c327..3ea88b4 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -5,7 +5,7 @@ lane :pods do end lane :tests do - scan(workspace: "Example/Paparajote.xcworkspace", scheme: "Paparajote-Example", clean: true) + scan(workspace: "Example/Paparajote.xcworkspace", scheme: "Paparajote", clean: true) end lane :travis do