To try out Swift Testing, I first wrote the code responsible for external API networking.
I structured it as a networking module that takes a request model and returns only the response model, making it reusable.
RequestModel
provides the URL string, query parameters, headers, HTTP method type, request body, and the type to decode.I separated it into a package, and since there was no need to upload it remotely, I developed it as a local package.
$ swift package init --name --type
Tuist Project.swift
The biggest impression I got from using test code is that you can run the package on a Mac or execute $ swift test
in the terminal without having to build the entire app. This lets you verify if the response values are correct, making testing incredibly fast.
I referred to blog posts by @whitelips on Medium, where WebView-related content is well organized.
A WebView is a web browser embedded in a native app.
On iOS, there are three ways to implement WebView: UIWebView
, WKWebView
, and SFSafariViewController
. UIWebView
cannot be used on iOS 12 and later. SFSafariViewController
allows displaying web content through the Safari browser, and WKWebView
is generally used.
The articles explain WKWebView’s cookie management, timeouts, multi-process architecture, strong references, and more, based on the WebKit open-source code, which is highly recommended.
Starting from iOS 18, there is an issue where the UIApplication.shared.open method does not get called. If you check the console at the time of failure, you’ll see the error: BUG IN CLIENT OF UIKIT: The caller of UIApplication.openURL(:) needs to migrate to the non-deprecated UIApplication.open(:options:completionHandler:). Force returning false (NO).
It appears that this issue is under discussion in the Apple Developer Forum.
🅾️ : UIApplication.shared.open(urlString, options: [:], completionHandler: nil)
❎ : UIApplication.shared.open(urlString)
From now on, you need to be careful with the parameters when using the open method.
$ flutter pub get
in the Flutter module you want to add.