If just doing a web wrapper, there's a bunch of open source solves for that that are pretty straight forward. At that point though, can you just direct folks to use the add to home screen options to get your icon on their homescreen instead of dealing with managing the apps as well?
If just doing a web wrapper, there's a bunch of open source solves for that that are pretty straight forward. At that point though, can you just direct folks to use the add to home screen options to get your icon on their homescreen instead of dealing with managing the apps as well?
150,000 non computer savvy users. Hence the ask for the webwrapper app. But yes, I agree with you.
would just google for a couple of the best open source ones, it’s a pretty straight forward process and then you don’t have to pay a dev just for a wrapper.
@bfarkas @lrnlab check it out
write an application for ios using the swift programming language that displays the website https://in.leadingre.com fullscreen using WKWebView. Include all code
Here is an example of an iOS application written in Swift that displays the website "https://in.leadingre.com" fullscreen using WKWebView:
import UIKit
import WebKit
class ViewController: UIViewController, WKUIDelegate {
var webView: WKWebView!
override func loadView() {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
let myURL = URL(string:"https://in.leadingre.com")
let myRequest = URLRequest(url: myURL!)
webView.load(myRequest)
}
}
This code creates a WKWebView
and sets it as the view for the view controller. The URL for the website "https://in.leadingre.com" is created and loaded into the web view in the viewDidLoad
method.
Here is a slightly improved version:
write an application for ios using the swift programming language that displays the website https://in.leadingre.com fullscreen using WKWebView. If the user exits the app, save the URL they have open and display that page instead of https://in.leadingre.com upon relaunching the app. Include all code
Here is an example of an iOS application written in Swift that displays the website "https://in.leadingre.com" fullscreen using WKWebView and saves the URL the user has open if they exit the app:
import UIKit
import WebKit
class ViewController: UIViewController, WKUIDelegate {
var webView: WKWebView!
override func loadView() {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
if let savedURL = UserDefaults.standard.url(forKey: "LastURL") {
let myRequest = URLRequest(url: savedURL)
webView.load(myRequest)
} else {
let myURL = URL(string:"https://in.leadingre.com")
let myRequest = URLRequest(url: myURL!)
webView.load(myRequest)
}
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
UserDefaults.standard.set(webView.url, forKey: "LastURL")
}
}
This code creates a WKWebView
and sets it as the view for the view controller. In the viewDidLoad
method, it checks if a URL has been saved using UserDefaults
using the key "LastURL". If a URL is found, it is loaded into the web view. If no URL is found, the default URL "https://in.leadingre.com" is loaded.
The URL that is currently being displayed in the web view is saved in UserDefaults
when the view controller is about to disappear (when the user exits the app) in the viewWillDisappear
method. This URL will be retrieved and loaded into the web view the next time the app is launched.
write an application for ios using the swift programming language that displays the website https://in.leadingre.com fullscreen using WKWebView. If the user exits the app, save the URL they have open and record the date and time. If they reopen the app within 12 hours, open that page instead of https://in.leadingre.com upon relaunching the app. If they reopen the app after 12 hours have elapsed, load the page https://in.leadingre.com instead of the saved page upon relaunching the app. Include all code
import UIKit
import WebKit
class ViewController: UIViewController {
var webView: WKWebView!
let userDefaults = UserDefaults.standard
let twelveHours: TimeInterval = 12 * 60 * 60
override func viewDidLoad() {
super.viewDidLoad()
webView = WKWebView(frame: view.frame)
view.addSubview(webView)
if let savedURL = userDefaults.url(forKey: "SavedURL") {
let currentDate = Date()
if let savedDate = userDefaults.value(forKey: "SavedDate") as? Date {
if currentDate.timeIntervalSince(savedDate) <= twelveHours {
webView.load(URLRequest(url: savedURL))
return
}
}
}
let url = URL(string: "https://in.leadingre.com")!
webView.load(URLRequest(url: url))
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
userDefaults.set(webView.url, forKey: "SavedURL")
userDefaults.set(Date(), forKey: "SavedDate")
}
}
This code uses the WKWebView
to display the website full-screen, and UserDefaults
to save the URL and date/time when the app exits. The viewDidLoad
method determines whether to load the saved URL or the default URL, based on the elapsed time since the saved date. The viewWillDisappear
method saves the current URL and date/time whenever the app is exited.
Tried compiling and I’m getting “invalid redeclaration of ViewController” on line 3