iOS WKWebView webview App Template with fully working persistent cookies functionality (httpcookie, web cookie, browser cookie), custom status bar background color, option for white/black status bar text color, option to disable pinch to zoom and double tap to zoom in webview

Overview

iOSWKWebViewAppTemplatePersistentCookiesWorkLikeACharm

iOS WKWebView webview App Template with fully working persistent cookies functionality (httpcookie, web cookie, browser cookie), custom status bar background color, option for white/black status bar text color, option to disable pinch to zoom and double tap to zoom in webview

You have probably noticed that by default iOS WKWebView resets all cookies if you swipe app off memory or every time app is reloaded and new app session started

This WKWebView app template has a solution and a fix to preserve and save cookies to provide expected functionality from web apps

Supported iOS 13.0 - 14.7.1 Succesfully tested and working on physical iOS 14.7.1 device and physical iPadOS 14.7.1 device

A very well-commented webview app template (probably even too much commented, probably I've failed all and every KISS principle while commenting this app template, but I wanted this app template to be easily understandable for absolute iOS beginners who had little or no previous iOS experience)

There are 5 ATTENTION: ACTION REQUIRED marks in the code
You can Cmd+F to quickly find them in code
Those steps are:

  1. Choose Status Bar background color
  2. Put your remote website URL here
  3. Choose if you want to allow users to use pinch to zoom gesture and double tap to zoom in webview
  4. Choose if you want Status Bar Text Color to be white or black
  5. Put your remote website URL here (one more time)

Currently, this iOS WKWebView App Template works by opening and browsing remote website by its URL

If you want to hide visibility of scroll bar you should do that in your remote website/webapp CSS code by adding:

*::-webkit-scrollbar {
   display: none;
}

If you want to enable iOS smooth scrolling everywhere or on specific elements, you also do it in remote website/webapp CSS code

Apply to whole website/webapp (CSS)

* {
   -webkit-overflow-scrolling: touch;
}

or apply to specific elements, for example: (CSS)

.someclass {
   overflow-y: scroll;
   -webkit-overflow-scrolling: touch;
}

More on smooth scrolling here: https://stackoverflow.com/questions/37313872/vertical-scrolling-in-ios-not-smooth https://css-tricks.com/snippets/css/momentum-scrolling-on-ios-overflow-elements/

Planned features and TO-DO's (feel free to pull request or fork):

  1. Option to browse local website (web app) shipped within iOS app bundle content (not only remote website by URL)
  2. Option to open external links (not your web app's URLs, other domains, website, external URLs, "You're leaving our website/app feature") in a visible mini-browser in app or even open some links or domains in Safari (or preferred default iOS web browsing app)
  3. Option to display "no internet connection" if there is no internet connection currently or browsing remote website fails by some other reason, or even "our servers currently down" if the internet connection is OK, but your remote web app fails by certain HTTP status codes. With button "Try to connect again"
  4. Add russian translation to README.md and even probably all the code comments (when I realize how, also feel free to pull request your translation to your native language or other you know well or fork!)

If you're looking for Android WebView App Template, my best recommendation would be https://github.com/slymax/webview - also works like a charm! (other author, not me)

Contact me easily anytime!
Email ilya.minichev [at] gmail [dot] com
Telegram | VK | VK Quick DM | Facebook | FB Messenger | Instagram | Twitter

If you want to tip, donate or buy me a coffee
Paypal or YooMoney (ex-Yandex.Money)

You might also like...
An iOS template project using SwiftUI, Combine and MVVM-C software architecture
An iOS template project using SwiftUI, Combine and MVVM-C software architecture

SwiftUI-MVVM-C A template project that uses SwiftUI for UI, Combine for event handling, MVVM-C for software architecture. I have done some small proje

An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and more.
An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and more.

SpotifyClone An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and

A simple App to Track the status of Covid-19 around the World. Using SwiftUI and GraphQL
A simple App to Track the status of Covid-19 around the World. Using SwiftUI and GraphQL

CovidUI CovidUI is a simple App to Track the status of Covid-19 around the World. This is a simple App I made to track the spread of Covid-19 for me a

SwiftUI + Firebase template
SwiftUI + Firebase template

SwiftUI + Firebase template project This is a template project with SwiftUI and Firebase. You can create an iOS with SwiftUI and Firebase right away w

A library of data structures for working with collections of identifiable elements in an ergonomic, performant way.
A library of data structures for working with collections of identifiable elements in an ergonomic, performant way.

Swift Identified Collections A library of data structures for working with collections of identifiable elements in an ergonomic, performant way. Motiv

Magic-8-Ball-iOS13 - Training project /Working with View

Magic-8-Ball-iOS13 Training project /Working with View Simulator.Screen.Recordin

📱 An app fully written in SwiftUI showcasing beautiful design and animations.
📱 An app fully written in SwiftUI showcasing beautiful design and animations.

DesignCode DesignCode is an app fully built using Apple's latest SwiftUI and Combine framework. Beautifully written code that is well intended for eas

A shopping app fully made in SwiftUI for iOS 14.1.
A shopping app fully made in SwiftUI for iOS 14.1.

A shopping app fully made in SwiftUI for iOS 14.1.

Recreating a fully functional version of iOS 4 in SwiftUI.
Recreating a fully functional version of iOS 4 in SwiftUI.

Updates: Version 1.0 is currently available 🎉 While I work on fixing an issue in Xcode 12.5+ with LazyVGrid, I recommend you build using Xcode 12.4 a

Owner
Ilya Minichev
Ilya Minichev
How to handle HelaPay links inside UIWebView and WKWebView

Handling හෙළPay Links Setup Clone this repo. git clone https://github.com/PayHereDevs/helapay-link-handler.git To properly handle හෙළPay Links in you

PayHereDevs 0 Feb 9, 2022
Conveniently getting the User Agent through WKWebView

WebKit User Agent Requirements iOS 9.0+ macOS 10.11+ Installation See the subsec

Dmytrii Golovanov 4 Dec 13, 2021
Example usage of FingerprintJS Pro inside a iOS WebView.

FingerprintJS Pro iOS Integrations An example app and packages demonstrating FingerprintJS Pro capabilities on the iOS platform. The repository illust

FingerprintJS 34 Nov 30, 2022
Example usage of FingerprintJS Pro inside a iOS WebView.

FingerprintJS Pro iOS Integrations An example app and packages demonstrating FingerprintJS Pro capabilities on the iOS platform. The repository illust

FingerprintJS 34 Nov 30, 2022
Simple app that tracks your works hours from the status bar.

Track Your Work Hours Simple app that tracks your works hours from status bar. Features: Simple and private. Data is stored in CSV in the Documents fo

Niteo 44 Dec 2, 2022
Stateful WebView for SwiftUI.

Stateful SwiftUI WebView for iOS and MacOS Fully functional, SwiftUI-ready WebView for iOS 13+ and MacOS 10.15+. Actions and state are both delivered

Gordan Glavaš 35 Dec 14, 2022
Single Webview project for xcode in swift

Single Webview project for xcode in swift An xcode project that with single webview(UIWebView) that opens external URL, for hybrid web app debug or te

null 0 Dec 11, 2021
ReactionButton is a control that allows developers to add this functionality to their apps in an easy way.

Since Facebook introduced reactions in 2016, it became a standard in several applications as a way for users to interact with content. ReactionButton is a control that allows developers to add this functionality to their apps in an easy way.

Jorge Ovalle 305 Oct 11, 2022
SwiftUI sample app using Clean Architecture. Examples of working with CoreData persistence, networking, dependency injection, unit testing, and more.

Articles related to this project Clean Architecture for SwiftUI Programmatic navigation in SwiftUI project Separation of Concerns in Software Design C

Alexey Naumov 4k Jan 8, 2023
Shopify app template powered by DSKit

This project is powered by DSKit a Design System Kit for iOS 13+, an iOS SDK written in Swift with a collection of reusable components, guided by clear standards, that can be assembled to build any number of applications.

imodeveloperlab 12 Dec 15, 2022