[GH-ISSUE #440] OAuthSwift Objective-C interface not generated with Swift 4 #287

Closed
opened 2026-03-03 16:47:24 +03:00 by kerem · 2 comments
Owner

Originally created by @alfogrillo on GitHub (Mar 2, 2018).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/440

Originally assigned to: @phimage on GitHub.

Compiling the pod with Swift 4, the Objective-C interface is not generated.
When i try to build with Swift 3.2 the build fails because a missing filter function on a dictionary.
The fix is quite simple. In the file OAuthSwiftHTTPRequest we have to refactor the line 239

finalParameters = parameters.filter { key, _ in !key.hasPrefix("oauth_") }

with something like this:

parameters.filter { key, _ in !key.hasPrefix("oauth_") }.forEach { finalParameters[$0] = $1 }

When the pod is compiled with Swift 3.2 the Objective-C interface is correctly generated.

Could I submit a pull request?

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

  • iOS

Installation method:

  • CocoaPods

Library version:

  • v1.2 (Swift 4.0)

Xcode version:

  • 9.0 (Swift 4.0)

  • 9.0 (Swift 3.2)

  • objective c

Originally created by @alfogrillo on GitHub (Mar 2, 2018). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/440 Originally assigned to: @phimage on GitHub. Compiling the pod with Swift 4, the Objective-C interface is not generated. When i try to build with Swift 3.2 the build fails because a missing `filter` function on a dictionary. The fix is quite simple. In the file `OAuthSwiftHTTPRequest` we have to refactor the line `239` `finalParameters = parameters.filter { key, _ in !key.hasPrefix("oauth_") }` with something like this: `parameters.filter { key, _ in !key.hasPrefix("oauth_") }.forEach { finalParameters[$0] = $1 }` When the pod is compiled with Swift 3.2 the Objective-C interface is correctly generated. Could I submit a pull request? ### OAuth Version: - [ ] Version 1 - [x] Version 2 ### OS (Please fill the version) : - [x] iOS ### Installation method: - [x] CocoaPods ### Library version: - [x] v1.2 (Swift 4.0) ### Xcode version: - [x] 9.0 (Swift 4.0) - [x] 9.0 (Swift 3.2) - [x] objective c
kerem closed this issue 2026-03-03 16:47:24 +03:00
Author
Owner

@phimage commented on GitHub (Mar 4, 2018):

Hi

I prefer to keep clean swift 4 code, not restore tricky code.
So I make a Dictionary extension to add filter

let me know if this work for you

<!-- gh-comment-id:370219332 --> @phimage commented on GitHub (Mar 4, 2018): Hi I prefer to keep clean swift 4 code, not restore tricky code. So I make a Dictionary extension to add filter let me know if this work for you
Author
Owner

@alfogrillo commented on GitHub (Mar 4, 2018):

Hi @phimage ,
It works perfectly! :-)

Thanks

<!-- gh-comment-id:370220394 --> @alfogrillo commented on GitHub (Mar 4, 2018): Hi @phimage , It works perfectly! :-) Thanks
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#287
No description provided.