[GH-ISSUE #386] Making changes to SFSafariViewController class #248

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

Originally created by @dannymout on GitHub (Jun 29, 2017).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/386

With the changes introduced to SFSafariViewController in iOS 10, it makes it possible to customize it a lot more. I'm using SafariURLHandler, but how can I access the SafariVC to make changes?

OS (Please fill the version) :

  • iOS :
  • OSX :
  • TVOS :
  • WatchOS

Library version:

  • head
  • v1.0.0
  • v0.6
  • other: v1.1.2

Xcode version:

  • 8.0 (Swift 3.0)
  • 8.0 (Swift 2.3)
  • 7.3.1
  • other: Xcode 9 and Swift 4
Originally created by @dannymout on GitHub (Jun 29, 2017). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/386 With the changes introduced to `SFSafariViewController` in iOS 10, it makes it possible to customize it a lot more. I'm using `SafariURLHandler`, but how can I access the SafariVC to make changes? ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS ### Library version: - [ ] head - [ ] v1.0.0 - [ ] v0.6 - [x] other: v1.1.2 ### Xcode version: - [ ] 8.0 (Swift 3.0) - [ ] 8.0 (Swift 2.3) - [ ] 7.3.1 - [x] other: Xcode 9 and Swift 4
kerem 2026-03-03 16:47:03 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@phimage commented on GitHub (Jun 30, 2017):

you can set a factory SafariURLHandler#factory
see https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/OAuthSwiftURLHandlerType.swift

then there is also

open var animated: Bool = true
open var presentCompletion: (() -> Void)?
open var dismissCompletion: (() -> Void)?
<!-- gh-comment-id:312193563 --> @phimage commented on GitHub (Jun 30, 2017): you can set a factory `SafariURLHandler#factory` see https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/OAuthSwiftURLHandlerType.swift then there is also ```swift open var animated: Bool = true open var presentCompletion: (() -> Void)? open var dismissCompletion: (() -> Void)? ```
Author
Owner

@dannymout commented on GitHub (Jul 4, 2017):

@phimage OK, so how does SafariURLHandler#factory work? Do you have a short code example?

<!-- gh-comment-id:312921744 --> @dannymout commented on GitHub (Jul 4, 2017): @phimage OK, so how does `SafariURLHandler#factory` work? Do you have a short code example?
Author
Owner

@phimage commented on GitHub (Jul 4, 2017):

.factory = { safari in

}

Simple closure

<!-- gh-comment-id:312921938 --> @phimage commented on GitHub (Jul 4, 2017): .factory = { safari in } Simple closure
Author
Owner

@dannymout commented on GitHub (Jul 4, 2017):

@phimage 'safari' is of type URL, that's why I was getting confused with SafariURLHandler#factory.

<!-- gh-comment-id:312924541 --> @dannymout commented on GitHub (Jul 4, 2017): @phimage 'safari' is of type URL, that's why I was getting confused with `SafariURLHandler#factory`.
Author
Owner

@phimage commented on GitHub (Jul 4, 2017):

Sorry
, just read the closure type

.factory = { url in
return SafaryXxxxxx(url :url)
}

<!-- gh-comment-id:312925346 --> @phimage commented on GitHub (Jul 4, 2017): Sorry , just read the closure type .factory = { url in return SafaryXxxxxx(url :url) }
Author
Owner

@phimage commented on GitHub (Jul 5, 2017):

ya but you not post your code, so how I can help? The error message is clear.

please look at demo code in
https://github.com/OAuthSwift/OAuthSwift/blob/master/Demo/Common/ViewController.swift
commited by
github.com/OAuthSwift/OAuthSwift@aceae6aaad
look for
SafariURLHandler

<!-- gh-comment-id:313018122 --> @phimage commented on GitHub (Jul 5, 2017): ya but you not post your code, so how I can help? The error message is clear. please look at demo code in https://github.com/OAuthSwift/OAuthSwift/blob/master/Demo/Common/ViewController.swift commited by https://github.com/OAuthSwift/OAuthSwift/commit/aceae6aaad5d3d5930f74119fadcdb4cdc2b5f52 look for `SafariURLHandler`
Author
Owner

@dannymout commented on GitHub (Jul 6, 2017):

@phimage Nevermind Xcode seemed to be acting up. When I looked over the code, mine looked the same, so I tried uncommenting what I wrote, and everything is fine. Thanks!

<!-- gh-comment-id:313491530 --> @dannymout commented on GitHub (Jul 6, 2017): @phimage Nevermind Xcode seemed to be acting up. When I looked over the code, mine looked the same, so I tried uncommenting what I wrote, and everything is fine. 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#248
No description provided.