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

Add Swift 3.0 support. #58

Merged
merged 10 commits into from
Sep 24, 2016
Merged

Add Swift 3.0 support. #58

merged 10 commits into from
Sep 24, 2016

Conversation

nlutsenko
Copy link
Contributor

@nlutsenko nlutsenko commented Sep 22, 2016

  • Updating all source files to Swift 3.0 syntax
  • Updating SwiftCatalog to Swift 3.0 and iOS 10

Most of the changes are simply due to language syntax change, but there are few API changes as well to make the SDK more Swifty :)

Kudos and thanks to:

Closes #53

@ghost ghost added GH Review: review-needed CLA Signed The Facebook CLA has been signed labels Sep 22, 2016
@nlutsenko nlutsenko added this to the 0.2.0 milestone Sep 22, 2016
public static func CompletedTutorial(successful successful: BooleanType? = nil,
valueToSum: Double? = nil,
extraParameters: ParametersDictionary = [:]) -> AppEvent {
public static func completedTutorial(successful: DarwinBoolean? = nil,
Copy link
Contributor

@richardjrossiii richardjrossiii Sep 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DarwinBoolean probably isn't the right choice here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, need to update.

extraParameters: ParametersDictionary = [:]) -> AppEvent {
public static func searched(contentId: String? = nil,
searchedString: String? = nil,
successful: DarwinBoolean? = nil,
Copy link
Contributor

@richardjrossiii richardjrossiii Sep 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DarwinBoolean

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, need to update.

public static func AddedPaymentInfo(successful successful: BooleanType? = nil,
valueToSum: Double? = nil,
extraParameters: ParametersDictionary = [:]) -> AppEvent {
public static func addedPaymentInfo(successful: DarwinBoolean? = nil,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DarwinBoolean

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, need to update.

@@ -59,7 +59,7 @@ extension GraphRequestProtocol {

- parameter completion: Optional completion closure that is going to be called when the connection finishes or fails.
*/
public func start(completion: ((httpResponse: NSHTTPURLResponse?, result: GraphRequestResult<Self>) -> Void)? = nil) {
public func start(_ completion: @escaping GraphRequestConnection.Completion<Self>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be GraphRequestConnection<Self>.Completion? The typealias itself doesn't have the generic paramter, GraphRequestConnection does, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will update.


/// The aspect ratio of the source image of the profile picture.
public var pictureAspectRatio = UserProfile.PictureAspectRatio.Square {
open var pictureAspectRatio = UserProfile.PictureAspectRatio.square {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open here should do nothing, as PictureView is final, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I knew I missed one of these.

}

/**
Logs the user out.
This calls `AccessToken.current = nil` and `Profile.current = nil`.
*/
public func logOut() {
open func logOut() {
Copy link
Contributor

@richardjrossiii richardjrossiii Sep 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, open on a final class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, should be public.

@nlutsenko
Copy link
Contributor Author

@richardjrossiii, updated and rebased:

  • Fixed all violations from open to public
  • Replaced DarwinBoolean with Bool
  • Made completion optional again on GraphRequestProtocol.start().

@nlutsenko nlutsenko force-pushed the nlutsenko.swift30 branch 6 times, most recently from 74305de to 856a973 Compare September 24, 2016 18:28
@nlutsenko nlutsenko merged commit 96d524e into master Sep 24, 2016
@nlutsenko nlutsenko deleted the nlutsenko.swift30 branch September 24, 2016 18:34
@nlutsenko nlutsenko added the enhancement Adds a feature or improvement label Sep 24, 2016
@aliabadi
Copy link

aliabadi commented Oct 4, 2016

When I add the Facebook dependencies to my Podfile it loads an older version of the SDK.

Is there something I'm missing? The readme says that's all you should have to do. I've tried copying all the newer swift files in, but that was fraught with errors...I was able to get it working by using the legacy swift option.

Thanks!

@ghost
Copy link

ghost commented Oct 17, 2016

This seems to be merged into master, but I can't get it to compile with Swift 3.0 in Xcode 8.0.

@simonstewart
Copy link

@ricardochavarria I'm seeing this issue as of today. Have you worked around it or still waiting?

@aliabadi
Copy link

I did find a workaround of sorts. I load the standard SDK through my podfile and when I open the new workspace I run the "Convert to Swift 3 Syntax" wizard and it works after that.

Just have to build the project afterwards and everything is fine.

Thanks!

@idelfonsog2
Copy link

@aliabadi when you said the standard... Do you mean the Obj-C or the swift sdk?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed The Facebook CLA has been signed enhancement Adds a feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants