🔗 SharedKit
Overview
import SharedKit

SharedKit Overview

SharedKit is included in each other Project Framework and contains useful convenience methods that can be used across all project files.


Root

AppData.swift

The AppData struct can be used to enter global App Information that can be accessed from anywhere in the app, such as the App Name, App Version, Developer Website and more.

LocalStorage.swift

LocalStorage is a convenience class to easily access UserDefaults information. From the get-go will only work in the main App bundle, but you can easily extend it to work with App Groups.


Helpers

getPlistEntry.swift

We use this helper function to access API Keys & other sensitive information from differnet Plist files. Even though the Property List files are located in different Frameworks, they are bundled in the main bundle.

isPreview.swift

Is a developer convenience method to check if the App is running in a SwiftUI Preview.


ViewModifier

if.swift

Conditionally apply a View Modifier to a View. Use this cautiously, as it may lead to unexpected SwiftUI behavior. But sometimes we just need to break the rules a little bit...

modifier.swift

Modify a view with a ViewBuilder closure. Note: Useful only when you don't need to reuse the closure.

onAppearAndChange.swift

Combines .onAppear() and onChange() into a single View Modifier. Will trigger something when the view appears and when the observed value changes.

sensitiveView.swift

SwiftyLaunch Version 1.2+

Will require the user to authenticate with Face ID, Touch ID or the device passcode to unblur the View. Will additionally blur the View when the app is in the background (in the App Switcher).

To just blur the View when the app is in the background, without the need to authenticate (as in Version 1.1), set protectWithBiometrics to false:

.sensitiveView(protectWithBiometrics: false)

You can also read how to use biometric authentication throughout your app in the Biometric Authentication section.

squircle.swift

A modifier to simulate the iOS App squircle shape.


Views

WebView.swift

WebView(url: URL)

Allows us to show WebKit View in SwiftUI.

.webViewSheet(_ showSheet: Binding<Bool>, url: URL, title: LocalizedStringKey)

View Modifier to show a WebView() in a Sheet when showSheet is true.

VideoPlayerAlphaView.swift

A view to play HEVC videos with alpha (transparency) as a better, more efficient alternative to GIFs. Used in the InAppPurchaseKit Paywall. Inspired by this GitHub Gist (opens in a new tab).