Is it possible customize SFSafariViewController like edit "Share" button? - ios

Is it possible customize SFSafariViewController like:
- change "Share" button
- or add new button on same toolbar where "Share" and "Compass" buttons are
Any help will be appreciated.

No. However, you can change some specific configuration of that controller. Namely:
through SFSafariViewControllerConfiguration, you have barCollapsingEnabled and entersReaderIfAvailable.
Data for activityItemsForURL and excludedActivityTypesForURL.
preferredBarTintColor and dismissButtonStyle, etc...
Apple says:
Important
In accordance with App Store Review Guidelines, this view controller
must be used to visibly present information to users; the controller
may not be hidden or obscured by other views or layers. Additionally,
an app may not use SFSafariViewController to track users without their
knowledge and consent.
Lastly, indeed, you may use WKWebView instead for further customisation of your screen.
If your app lets users view websites from anywhere on the Internet,
use the SFSafariViewController class. If your app customizes,
interacts with, or controls the display of web content, use the
WKWebView class.
Read doc: https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller

Related

iOS Embed Activity (share) View Inline

The iOS UIActivityViewController overlays existing content as a stack. It is customisable but is there a way to move its position entirely and embed it inside another view.
Say I have a list of the user's contacts whom use my app. When clicking on one of those contacts, instead of overlaying the ActivityView, the contact would expand (accordion) and reveal certain elements of the ActivityView to allow user sharing.
I appreciate that this can be done by writing a custom Activity View however, unless I'm mistaken, there is no way to ascertain whether the user has certain other apps installed to allow sharing via WhatsApp or Messenger for example.

Hide controls in sfsafariviewcontroller

let sfViewController = SFSafariViewController(url: url)
sfViewController.delegate = self
self.ViewC!.present(sfViewController, animated: false, completion: nil)
I am opening a SFSafariViewController in my app. But for the security issue I do not want the controls given by this view. This view is giving Actions like- Done, Refresh, Share, Open in Safari.
For My purpose I just want Action- Done. Rest other actions should not be visible to user. I am supporting ios 10.0 + .
Atleast that toolbar should not be there.
Is it possible to do this?
No, You Can't customize SFSafariViewController .
Apple says:
Important
In accordance with App Store Review Guidelines, this view controller
must be used to visibly present information to users; the controller
may not be hidden or obscured by other views or layers. Additionally,
an app may not use SFSafariViewController to track users without their
knowledge and consent.
Lastly, indeed, you may use WKWebView instead for further customisation of your screen.
If your app lets users view websites from anywhere on the Internet,
use the SFSafariViewController class. If your app customizes,
interacts with, or controls the display of web content, use the
WKWebView class.
Read doc: https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller

Hide share options in Safari View Controller

Is there any way to hide the share option in Safari View Controller, which is coming by default?. I am trying to hide the extra options which are given by default with the Safari View Controller but not able to do so.
Let me know if anybody knows about this.
Thanks!
SFSafariViewController is not meant for customizations. Even Apple documentation says to use WKWebView if you want to customise the look and feel of safari view controller.
From Apple documentation
Choosing the Best Web Viewing Class
If your app lets users view websites from anywhere on the Internet,
use the SFSafariViewController class. If your app customizes,
interacts with, or controls the display of web content, use the
WKWebView class. When you adopt SFSafariViewController and a user
presses a link to peek at and then pop to the link’s destination, the
user views web content from within your app. Tapping Done, the user
returns to the view controller that was displayed before the web
content was loaded. When you instead use the WKWebView class, Peek and
Pop sends the user to Safari by default.
On the other hand, SFSafariViewController does provide some kind of UI customization. You can only change the preferredBarTintColor and prefererredControlTintColor. iOS 11 has new option to set initial configuration by using #NSCopying var configuration: SFSafariViewController.Configuration { get } but sadly that will not help you either

How can I customise the dictation view in presentTextInputControllerWithSuggestions

I made a page with a presentTextInputControllerWithSuggestions and I want to customise the dictation view.
I don't want to see "Cancel" but "Retry" for example.
I saw that in Messages app, the dictation view is the default view but with "Send" and not "Done".
Do you have an idea if this customisation is available and how can I do it ?
No, it's not possible to customize the Cancel and Done buttons.
Apple can use their private API methods to customize the UI/UX for their apps to do what we can't (yet).
Best thing to do is to submit a feature request.
You can determine what you're able to change by looking at the documentation methods or examining the header files, both of which are readily available within Xcode.

How can i add tabs in iOS on a particular screen?

I am building an app where I need to add a TabBarController on a particular screen, Lets assume maybe on second or third screen.
I have gone through several blogs but everyone says UITabBarController can be added as an initial view controller only.
But I want it for some few screens only. How can I accomplish it?
Need guidance!
The answer is "you shouldn't."
From the Human Interface Guidelines:
"In general, use a tab bar to organize information at the app level. A tab bar is well suited for use in the main app view because it’s a good way to flatten your information hierarchy and provide access to several peer information categories or modes at one time.
Don’t use a tab bar to give users controls that act on elements in the current screen or app mode. If you need to provide controls, including a control that displays a modal view, use a toolbar instead (for usage guidelines, see Toolbar). "

Resources