Number : 022, Date: 2025-06-30

2025.06.16 ~ 2025.06.29

🌍 WKWebView Caching


$ curl -I 

By entering the command above, you can find information about cache-control, etag support, and HTTP version.

If cache-control’s max-age is set to 24 hours, and the resource has changed, you should not use caching and reload it through etag.

Previously, I manually removed the cache and loaded, meaning I didn’t use caching. However, I found that I could automatically verify the etag by specifying the URLRequest’s cachePolicy before calling the load function, so I changed it and checked.

What is an etag? It’s a value that can identify when a resource has changed. When adding the etag to the request header, it’s case-insensitive, and an HTTP Status Code of 304 is the response code for a changed resource.

func clearWebViewCache(completion: @escaping () -> Void) {
      URLCache.shared.removeAllCachedResponses()
      
      let websiteDataTypes = Set(arrayLiteral: WKWebsiteDataTypeDiskCache,
                                 WKWebsiteDataTypeOfflineWebApplicationCache,
                                 WKWebsiteDataTypeMemoryCache,
                                 WKWebsiteDataTypeLocalStorage,
                                 WKWebsiteDataTypeFetchCache,
                                 WKWebsiteDataTypeServiceWorkerRegistrations)
      
      let fromDate = Date.init(timeIntervalSince1970: 0)
      
      WKWebsiteDataStore.default().removeData(ofTypes: websiteDataTypes, modifiedSince: fromDate) {
					completion()
      }
}

webView.load(URLRequest(url: url, cachePolicy: .reloadRevalidatingCacheData))

As a result of testing, there was no significant difference in loading speed between the method of not using caching at all and the method of verifying the etag by specifying the cachePolicy, as the HTTP request proceeds.

I need to further review whether the test method was wrong or if there is originally no significant difference in the operation method, as the official documentation does not explain in detail how reloadRevalidatingCacheData works, but there was an advantage in that the code line was reduced.

👉 HTML + CSS + React + NextJS


As an app developer, I thought that knowing the structure and operation of the front-end would be helpful when communicating or working on web-view and HTML parsing, so I studied HTML and CSS again.

Even though I didn’t learn JS, modern programming languages have similar grammars, so there were no major difficulties in understanding.

I watched a YouTube channel called Code With Antonio and created a REST API using expressJS and MongoDB Atlas, and I also created a clone website after watching NetflixClone.

  1. The Complete Guide To Building A REST API With Node, Express, TypeScript & MongoDB + Authentication
  2. Full Stack Netflix Clone in React, Tailwind CSS, Next.JS, Prisma, MongoDB, NextAuth & Vercel (2023)

🙋🏻‍♂️ Other Notes


  1. I heard that services that use AI in the terminal, such as gemini-cli and claude code, are good, so I checked them out, but they are still in beta, and I’m not sure what the difference is compared to cursor.
  2. While creating a Notion page, I tried to use various widgets, and there were a wide variety of widget sites.