Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Commit

Permalink
Merge pull request #58 from facebook/nlutsenko.swift30
Browse files Browse the repository at this point in the history
Add Swift 3.0 support.
  • Loading branch information
nlutsenko authored Sep 24, 2016
2 parents 2f3a4a0 + 856a973 commit 96d524e
Show file tree
Hide file tree
Showing 102 changed files with 1,111 additions and 1,066 deletions.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ branches:
- master
language: objective-c
os: osx
osx_image: xcode7.3
osx_image: xcode8
cache:
- cocoapods
env:
Expand All @@ -30,17 +30,15 @@ script:
- |
if [ "$TEST_TYPE" = iOS ]; then
set -o pipefail
xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme FacebookCore -configuration Debug -destination "platform=iOS Simulator,name=iPhone 4s" -destination "platform=iOS Simulator,name=iPhone 6 Plus" | xcpretty -c
xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme FacebookLogin -configuration Debug -destination "platform=iOS Simulator,name=iPhone 4s" -destination "platform=iOS Simulator,name=iPhone 6 Plus" | xcpretty -c
xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme FacebookShare -configuration Debug -destination "platform=iOS Simulator,name=iPhone 4s" -destination "platform=iOS Simulator,name=iPhone 6 Plus" | xcpretty -c
xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme FacebookCore -configuration Debug -destination "platform=iOS Simulator,name=iPhone 5" -destination "platform=iOS Simulator,name=iPhone 7 Plus" | xcpretty -c
xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme FacebookLogin -configuration Debug -destination "platform=iOS Simulator,name=iPhone 5" -destination "platform=iOS Simulator,name=iPhone 7 Plus" | xcpretty -c
xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme FacebookShare -configuration Debug -destination "platform=iOS Simulator,name=iPhone 5" -destination "platform=iOS Simulator,name=iPhone 7 Plus" | xcpretty -c
elif [ "$TEST_TYPE" = Lint ]; then
swiftlint lint --path Sources --quiet
swiftlint lint --path Samples --quiet
elif [ "$TEST_TYPE" = Samples ]; then
set -o pipefail
xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme SwiftCatalog -configuration Debug -destination "platform=iOS Simulator,name=iPhone 4s" -destination "platform=iOS Simulator,name=iPhone 6 Plus" | xcpretty -c
xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme SwiftCatalog -configuration Debug -destination "platform=iOS Simulator,name=iPhone 5" -destination "platform=iOS Simulator,name=iPhone 7 Plus" | xcpretty -c
elif [ "$TEST_TYPE" = CocoaPods ]; then
pod lib lint FacebookCore.podspec
pod lib lint FacebookLogin.podspec
pod lib lint FacebookShare.podspec
fi
2 changes: 1 addition & 1 deletion Configurations/FacebookCore.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
PRODUCT_NAME = FacebookCore
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.swift.core

SWIFT_VERSION = 2.3
SWIFT_VERSION = 3.0

IPHONEOS_DEPLOYMENT_TARGET = 8.0

Expand Down
2 changes: 1 addition & 1 deletion Configurations/FacebookLogin.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
PRODUCT_NAME = FacebookLogin
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.swift.login

SWIFT_VERSION = 2.3
SWIFT_VERSION = 3.0

IPHONEOS_DEPLOYMENT_TARGET = 8.0

Expand Down
2 changes: 1 addition & 1 deletion Configurations/FacebookShare.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
PRODUCT_NAME = FacebookShare
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.swift.share

SWIFT_VERSION = 2.3
SWIFT_VERSION = 3.0

IPHONEOS_DEPLOYMENT_TARGET = 8.0

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ source 'https://rubygems.org'

gem 'rake'
gem 'jazzy'
gem 'cocoapods'
gem 'cocoapods', '>=1.1.0.rc.2'
49 changes: 26 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (5.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
activesupport (4.2.7.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
claide (1.0.0)
cocoapods (1.0.1)
activesupport (>= 4.0.2)
cocoapods (1.1.0.rc.2)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.0, < 2.0)
cocoapods-core (= 1.0.1)
cocoapods-deintegrate (>= 1.0.0, < 2.0)
cocoapods-downloader (>= 1.0.0, < 2.0)
cocoapods-core (= 1.1.0.rc.2)
cocoapods-deintegrate (>= 1.0.1, < 2.0)
cocoapods-downloader (>= 1.1.1, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.0.0, < 2.0)
cocoapods-try (>= 1.0.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored (~> 1.2)
escape (~> 0.0.4)
fourflusher (~> 0.3.0)
molinillo (~> 0.4.5)
fourflusher (~> 1.0.1)
gh_inspector (~> 1.0)
molinillo (~> 0.5.1)
nap (~> 1.0)
xcodeproj (>= 1.1.0, < 2.0)
cocoapods-core (1.0.1)
activesupport (>= 4.0.2)
xcodeproj (>= 1.3.1, < 2.0)
cocoapods-core (1.1.0.rc.2)
activesupport (>= 4.0.2, < 5)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.0)
cocoapods-downloader (1.1.0)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
Expand All @@ -39,12 +41,12 @@ GEM
netrc (= 0.7.8)
cocoapods-try (1.1.0)
colored (1.2)
concurrent-ruby (1.0.2)
escape (0.0.4)
fourflusher (0.3.2)
fourflusher (1.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.0.2)
i18n (0.7.0)
jazzy (0.7.0)
jazzy (0.7.2)
cocoapods (~> 1.0)
mustache (~> 0.99)
open4
Expand All @@ -53,14 +55,15 @@ GEM
sass (~> 3.4)
sqlite3 (~> 1.3)
xcinvoke (~> 0.2.1)
json (1.8.3)
liferaft (0.0.4)
minitest (5.9.0)
molinillo (0.4.5)
molinillo (0.5.1)
mustache (0.99.8)
nap (1.1.0)
netrc (0.7.8)
open4 (1.3.4)
rake (11.2.2)
rake (11.3.0)
redcarpet (3.3.4)
rouge (1.11.1)
sass (3.4.22)
Expand All @@ -70,7 +73,7 @@ GEM
thread_safe (~> 0.1)
xcinvoke (0.2.1)
liferaft (~> 0.0.4)
xcodeproj (1.2.0)
xcodeproj (1.3.1)
activesupport (>= 3)
claide (>= 1.0.0, < 2.0)
colored (~> 1.2)
Expand All @@ -79,9 +82,9 @@ PLATFORMS
ruby

DEPENDENCIES
cocoapods
cocoapods (>= 1.1.0.rc.2)
jazzy
rake

BUNDLED WITH
1.12.5
1.13.1
3 changes: 2 additions & 1 deletion Samples/Catalog/Configurations/SwiftCatalog.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ PRODUCT_NAME = SwiftCatalog
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.SwiftCatalog

CODE_SIGN_IDENTITY = iPhone Developer
CODE_SIGN_ENTITLEMENTS = Resources/SwiftCatalog.entitlements

SWIFT_VERSION = 2.3
SWIFT_VERSION = 3.0

IPHONEOS_DEPLOYMENT_TARGET = 8.0

Expand Down
2 changes: 2 additions & 0 deletions Samples/Catalog/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
<true/>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Share content from Photo Library on Facebook.</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand Down
10 changes: 10 additions & 0 deletions Samples/Catalog/Resources/SwiftCatalog.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?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>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.facebook.SwiftCatalog</string>
</array>
</dict>
</plist>
4 changes: 2 additions & 2 deletions Samples/Catalog/Sources/AlertController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import UIKit

extension UIAlertController {
convenience init(title: String, message: String) {
self.init(title: title, message: message, preferredStyle: .Alert)
self.init(title: title, message: message, preferredStyle: .alert)
let action = UIAlertAction(title: NSLocalizedString("OK", comment: "OK action"),
style: .Default,
style: .default,
handler: nil)
addAction(action)
}
Expand Down
13 changes: 7 additions & 6 deletions Samples/Catalog/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,26 @@ final class AppDelegate: UIResponder {
}

extension AppDelegate: UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)

return true
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return SDKApplicationDelegate.shared.application(application,
openURL: url,
open: url,
sourceApplication: sourceApplication,
annotation: annotation)
}

@available(iOS 9.0, *)
func application(application: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
return SDKApplicationDelegate.shared.application(application, openURL: url, options: options)
func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
return SDKApplicationDelegate.shared.application(application, open: url, options: options)
}

func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
AppEventsLogger.activate(application)
}
}
48 changes: 24 additions & 24 deletions Samples/Catalog/Sources/AppInviteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,34 @@ import UIKit
import FacebookShare

final class AppInviteViewController: UITableViewController {
func showAppInviteDialog(for appInvite: AppInvite) {
do {
try AppInvite.Dialog.show(from: self, invite: appInvite) { result in
switch result {
case .Success(let result):
print("App Invite Sent with result \(result)")
case .Failed(let error):
print("Failed to send app invite with error \(error)")
}
}
} catch let error {
print("Failed to show app invite dialog with error \(error)")
func showAppInviteDialog(for appInvite: AppInvite) {
do {
try AppInvite.Dialog.show(from: self, invite: appInvite) { result in
switch result {
case .success(let result):
print("App Invite Sent with result \(result)")
case .failed(let error):
print("Failed to send app invite with error \(error)")
}
}
} catch let error {
print("Failed to show app invite dialog with error \(error)")
}
}
}

extension AppInviteViewController {
@IBAction func appInviteWithDefaultImage() {
// Facebook hosted App Link is used here. See https://developers.facebook.com/docs/applinks for details.
let appInvite = AppInvite(appLink: NSURL(string: "https://fb.me/1539184863038815")!, deliveryMethod: .Facebook)
showAppInviteDialog(for: appInvite)
}
@IBAction func appInviteWithDefaultImage() {
// Facebook hosted App Link is used here. See https://developers.facebook.com/docs/applinks for details.
let appInvite = AppInvite(appLink: URL(string: "https://fb.me/1539184863038815")!, deliveryMethod: .facebook)
showAppInviteDialog(for: appInvite)
}

@IBAction func appInviteWithCustomImage() {
// Facebook hosted App Link is used here. See https://developers.facebook.com/docs/applinks for details.
let appInvite = AppInvite(appLink: NSURL(string: "https://fb.me/1539184863038815")!,
deliveryMethod: .Facebook,
previewImageURL: NSURL(string: "http://catalogapp.parseapp.com/FacebookDeveloper.jpg"))
showAppInviteDialog(for: appInvite)
}
@IBAction func appInviteWithCustomImage() {
// Facebook hosted App Link is used here. See https://developers.facebook.com/docs/applinks for details.
let appInvite = AppInvite(appLink: URL(string: "https://fb.me/1539184863038815")!,
deliveryMethod: .facebook,
previewImageURL: URL(string: "http://catalogapp.parseapp.com/FacebookDeveloper.jpg"))
showAppInviteDialog(for: appInvite)
}
}
4 changes: 2 additions & 2 deletions Samples/Catalog/Sources/CustomAppEventViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension CustomAppEventViewController {
@IBAction func logCustomEvent() {
guard let eventName = eventNameField?.text else {
let alertController = UIAlertController(title: "Invalid Event", message: "Event name can't be empty.")
presentViewController(alertController, animated: true, completion: nil)
present(alertController, animated: true, completion: nil)
return
}

Expand All @@ -41,6 +41,6 @@ extension CustomAppEventViewController {
// See https://developers.facebook.com/docs/analytics for details.

let alertController = UIAlertController(title: "Log Event", message: "Log Event Success")
presentViewController(alertController, animated: true, completion: nil)
present(alertController, animated: true, completion: nil)
}
}
12 changes: 6 additions & 6 deletions Samples/Catalog/Sources/GraphAPIPostViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ import UIKit
import FacebookCore

class GraphAPIPostViewController: UITableViewController {
func presentAlertControllerFor(result: GraphRequestResult<GraphRequest>) {
func presentAlertControllerFor(_ result: GraphRequestResult<GraphRequest>) {
let alertController: UIAlertController
switch result {
case .Success(let response):
case .success(let response):
alertController = UIAlertController(title: "Graph Request Success",
message: "Graph Request Succeeded with response: \(response)")
case .Failed(let error):
case .failed(let error):
alertController = UIAlertController(title: "Graph Request Failed",
message: "Graph Request Failed with error: \(error)")
}
presentViewController(alertController, animated: true, completion: nil)
present(alertController, animated: true, completion: nil)
}
}

Expand All @@ -52,9 +52,9 @@ extension GraphAPIPostViewController {
httpMethod: .POST)
request.start { httpResponse, result in
switch result {
case .Success(let response):
case .success(let response):
print("Graph Request Succeeded: \(response)")
case .Failed(let error):
case .failed(let error):
print("Graph Request Failed: \(error)")
}

Expand Down
Loading

0 comments on commit 96d524e

Please sign in to comment.