jestro
jestro

Reputation: 2593

Is there any way to clear SFSafariViewController's cache?

Is the only way to clear the cache of SFSafariViewController by clearing Safari's cache in the Settings app?

Upvotes: 3

Views: 2125

Answers (3)

GhrVinay
GhrVinay

Reputation: 11

From iOS 16 and above there is an option to clear SafariViewController caching via SFSafariViewController.DataStore.default.clearWebsiteData(). But yeah it's recommended to use WKWebView for more complex web based actions (as it gets hard to maintain/customise SFSafariViewController). Also refer https://stackoverflow.com/a/35709357/18340745

Upvotes: 0

aeharding
aeharding

Reputation: 578

SFSafariViewController.DataStore.default.clearWebsiteData()

Upvotes: 1

Chris
Chris

Reputation: 1750

According to the documentation yes. SFSafariViewController is meant to be secure with very limited developer interaction. Anything more complicated or custom you'd have to use a custom WKWebView. Would be nice if SFSafariViewController were a little more flexible though.

Upvotes: 3

Related Questions