Skip to content
Skip
3k

App Support

This Skip Lite module enhances the SkipUI package with commonly-used features, such as a permission checker and a picker for photos and other media.

To include this framework in your project, add the following dependency to your Package.swift file:

let package = Package(
name: "my-package",
products: [
.library(name: "MyProduct", targets: ["MyTarget"]),
],
dependencies: [
.package(url: "https://source.skip.dev/skip-kit.git", from: "1.0.0"),
],
targets: [
.target(name: "MyTarget", dependencies: [
.product(name: "SkipKit", package: "skip-kit")
])
]
)

The Cache<Key, Value> class manages a memory-pressure-aware cache that can be used for storing temporary values.

Example usage:

// Create a cache that can store up to 100 bytes of Data instances
// and will evict everything when the app is put in the background
let cache = Cache<UUID, Data>(evictOnBackground: true, limit: 100, cost: \.count)
cache.putValue(Data(count: 1), for: UUID()) // total cost = 1
cache.putValue(Data(count: 99), for: UUID()) // total cost = 100
cache.putValue(Data(count: 1), for: UUID()) // total cost = 101, so cache will evict older entries

AppInfo.current provides read-only access to information about the currently running application, including its version, name, bundle identifier, build configuration, and platform details. It works consistently on both iOS and Android.

import SkipKit
let info = AppInfo.current
// Version and identity
print("App Name: \(info.displayName ?? "Unknown")")
print("App ID: \(info.appIdentifier ?? "Unknown")")
print("Version: \(info.version ?? "Unknown")")
print("Build: \(info.buildNumber ?? "Unknown")")
print("Full: \(info.versionWithBuild)") // e.g. "1.2.3 (42)"
// Build configuration
if info.isDebug {
print("Running in debug mode")
}
if info.isTestFlight {
print("Installed from TestFlight")
}
// Platform
print("OS: \(info.osName) \(info.osVersion)") // e.g. "iOS 17.4.1" or "Android 34"
print("Device: \(info.deviceModel)") // e.g. "iPhone15,2" or "Pixel 7"
Text("Version \(AppInfo.current.versionWithBuild)")
// Displays: "Version 1.2.3 (42)"
if AppInfo.current.isDebug {
// Show debug tools, logging, etc.
} else {
// Production behavior
}

On iOS, you can query raw Info.plist values:

let keys = AppInfo.current.infoDictionaryKeys
if let minOS = AppInfo.current.infoDictionaryValue(forKey: "MinimumOSVersion") as? String {
print("Requires iOS \(minOS)")
}
let schemes = AppInfo.current.urlSchemes
// e.g. ["myapp"] from CFBundleURLTypes
PropertyTypeDescription
bundleIdentifierString?Bundle ID (iOS) or package name (Android)
displayNameString?User-visible app name
versionString?Version string (e.g. "1.2.3")
buildNumberString?Build number as string
buildNumberIntInt?Build number as integer
versionWithBuildStringCombined "version (build)" string
isDebugBoolDebug build (DEBUG flag on iOS, FLAG_DEBUGGABLE on Android)
isReleaseBoolRelease build (inverse of isDebug)
isTestFlightBoolTestFlight install (iOS only, always false on Android)
osNameStringPlatform name ("iOS", "Android", "macOS")
osVersionStringOS version (e.g. "17.4.1" or "34" for API level)
deviceModelStringDevice model (e.g. "iPhone15,2", "Pixel 7")
minimumOSVersionString?Minimum required OS version
urlSchemes[String]Registered URL schemes (iOS only)
infoDictionaryKeys[String]All Info.plist keys (iOS only)
infoDictionaryValue(forKey:)Any?Raw Info.plist value lookup (iOS only)

Android implementation: Reads from PackageManager.getPackageInfo(), ApplicationInfo, and android.os.Build. The osVersion returns the SDK API level (e.g. "34" for Android 14). The isDebug flag checks ApplicationInfo.FLAG_DEBUGGABLE.

DeviceInfo.current provides information about the physical device, including screen dimensions, device type, battery status, network connectivity, and locale.

import SkipKit
let device = DeviceInfo.current
print("Screen: \(device.screenWidth) x \(device.screenHeight) points")
print("Scale: \(device.screenScale)x")

Determine whether the app is running on a phone, tablet, desktop, TV, or watch:

switch DeviceInfo.current.deviceType {
case .phone: print("Phone")
case .tablet: print("Tablet")
case .desktop: print("Desktop")
case .tv: print("TV")
case .watch: print("Watch")
case .unknown: print("Unknown")
}
// Convenience checks
if DeviceInfo.current.isTablet {
// Use tablet layout
}

On iOS, this uses UIDevice.current.userInterfaceIdiom. On Android, it uses the screen layout configuration (large/xlarge = tablet).

print("Manufacturer: \(DeviceInfo.current.manufacturer)") // "Apple" or "Google", "Samsung", etc.
print("Model: \(DeviceInfo.current.modelName)") // "iPhone15,2" or "Pixel 7"
if let level = DeviceInfo.current.batteryLevel {
print("Battery: \(Int(level * 100))%")
}
switch DeviceInfo.current.batteryState {
case .charging: print("Charging")
case .full: print("Full")
case .unplugged: print("On battery")
case .unknown: print("Unknown")
}

On iOS, uses UIDevice.current.batteryLevel and .batteryState. On Android, uses BatteryManager.

For a single point-in-time check, use the synchronous properties:

let status = DeviceInfo.current.networkStatus
switch status {
case .wifi: print("Connected via Wi-Fi")
case .cellular: print("Connected via cellular")
case .ethernet: print("Connected via Ethernet")
case .other: print("Connected (other)")
case .offline: print("No connection")
}
// Convenience checks
if DeviceInfo.current.isOnline {
// Proceed with network request
}
if DeviceInfo.current.isOnWifi {
// Safe for large downloads
}

For live updates whenever connectivity changes, use monitorNetwork() which returns an AsyncStream<NetworkStatus>. The stream emits an initial value immediately and then a new value each time the network status changes:

struct ConnectivityView: View {
@State var status: NetworkStatus = .offline
var body: some View {
VStack {
Text("Network: \(status.rawValue)")
Circle()
.fill(status == .offline ? Color.red : Color.green)
.frame(width: 20, height: 20)
}
.task {
for await newStatus in DeviceInfo.current.monitorNetwork() {
status = newStatus
}
}
}
}

You can also use it in non-UI code:

func waitForConnectivity() async -> NetworkStatus {
for await status in DeviceInfo.current.monitorNetwork() {
if status != .offline {
return status
}
}
return .offline
}

Cancel the monitoring by cancelling the enclosing Task:

let monitorTask = Task {
for await status in DeviceInfo.current.monitorNetwork() {
print("Status changed: \(status.rawValue)")
}
}
// Later, stop monitoring:
monitorTask.cancel()

On iOS, monitorNetwork() uses NWPathMonitor for live path updates. On Android, it uses ConnectivityManager.registerDefaultNetworkCallback which receives onAvailable, onLost, and onCapabilitiesChanged callbacks. The callback is automatically unregistered when the stream is cancelled.

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
print("Locale: \(DeviceInfo.current.localeIdentifier)") // e.g. "en_US"
print("Language: \(DeviceInfo.current.languageCode ?? "")") // e.g. "en"
print("Time zone: \(DeviceInfo.current.timeZoneIdentifier)") // e.g. "America/New_York"

Screen:

PropertyTypeDescription
screenWidthDoubleScreen width in points
screenHeightDoubleScreen height in points
screenScaleDoublePixels per point

Device:

PropertyTypeDescription
deviceTypeDeviceType.phone, .tablet, .desktop, .tv, .watch, .unknown
isTabletBoolWhether the device is a tablet
isPhoneBoolWhether the device is a phone
manufacturerStringDevice manufacturer ("Apple" on iOS)
modelNameStringModel identifier (e.g. "iPhone15,2", "Pixel 7")

Battery:

PropertyTypeDescription
batteryLevelDouble?Battery level 0.0–1.0, or nil if unavailable
batteryStateBatteryState.unplugged, .charging, .full, .unknown

Network:

PropertyTypeDescription
networkStatusNetworkStatusOne-shot connectivity check
isOnlineBoolHas any network connectivity (one-shot)
isOnWifiBoolConnected via Wi-Fi (one-shot)
isOnCellularBoolConnected via cellular (one-shot)
monitorNetwork()AsyncStream<NetworkStatus>Live connectivity updates

Locale:

PropertyTypeDescription
localeIdentifierStringCurrent locale (e.g. "en_US")
languageCodeString?Language code (e.g. "en")
timeZoneIdentifierStringTime zone (e.g. "America/New_York")

The PermissionManager provides the ability to request device permissions.

For example:

import SkipKit
import SkipDevice
let locationProvider = LocationProvider()
if await PermissionManager.requestPermission(.ACCESS_FINE_LOCATION) == true {
let location = try await locationProvider.fetchCurrentLocation()
}

In addition to symbolic constants, there are also functions for requesting specific permissions with various parameters:

static func queryLocationPermission(precise: Bool, always: Bool) -> PermissionAuthorization
static func requestLocationPermission(precise: Bool, always: Bool) async -> PermissionAuthorization
static func queryPostNotificationPermission() async -> PermissionAuthorization
static func requestPostNotificationPermission(alert: Bool = true, sound: Bool = true, badge: Bool = true) async throws -> PermissionAuthorization
static func queryCameraPermission() -> PermissionAuthorization
static func requestCameraPermission() async -> PermissionAuthorization
static func queryRecordAudioPermission() -> PermissionAuthorization
static func requestRecordAudioPermission() async -> PermissionAuthorization
static func queryContactsPermission(readWrite: Bool) -> PermissionAuthorization
static func requestContactsPermission(readWrite: Bool) async throws -> PermissionAuthorization
static func queryCalendarPermission(readWrite: Bool) -> PermissionAuthorization
static func requestCalendarPermission(readWrite: Bool) async throws -> PermissionAuthorization
static func queryReminderPermission(readWrite: Bool) -> PermissionAuthorization
static func requestReminderPermission(readWrite: Bool) async throws -> PermissionAuthorization
static func queryPhotoLibraryPermission(readWrite: Bool) -> PermissionAuthorization
static func requestPhotoLibraryPermission(readWrite: Bool) async -> PermissionAuthorization

To request an arbitrary Android permission for which there may be no iOS equivalent, you can pass the string literal. For a list of common permission literals, see https://developer.android.com/reference/android/Manifest.permission.

For example, to request the SMS sending permission:

let granted = await PermissionManager.requestPermission("android.permission.SEND_SMS")

The View.withMediaPicker(type:isPresented:selectedImageURL:) extension function can be used to enable the acquisition of an image from either the system camera or the user’s media library.

On iOS, this camera selector will be presented in a fullScreenCover view, whereas the media library browser will be presented in a sheet. In both cases, a standad UIImagePickerController will be used to acquire the media.

On Android, the camera and library browser will be activated through an Intent after querying for the necessary permissions.

Following is an example of implementing a media selection button that will bring up the system user interface.

import SkipKit
/// A button that enables the selection of media from the library or the taking of a photo.
///
/// The selected/captured image will be communicated through the `selectedImageURL` binding,
/// which can be observed with `onChange` to perform an action when the media URL is acquired.
struct MediaButton : View {
let type: MediaPickerType // either .camera or .library
@Binding var selectedImageURL: URL?
@State private var showPicker = false
var body: some View {
Button(type == .camera ? "Take Photo" : "Select Media") {
showPicker = true // activate the media picker
}
.withMediaPicker(type: .camera, isPresented: $showPicker, selectedImageURL: $selectedImageURL)
}
}

In order to access the device’s photos or media library, you will need to declare the permissions in the app’s metadata.

On iOS this can be done by editing the Darwin/AppName.xcconfig file and adding the lines:

INFOPLIST_KEY_NSCameraUsageDescription = "This app needs to access the camera";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "This app needs to access the photo library.";

On Android, the app/src/main/AndroidManifest.xml file will need to be edited to include camera permissions as well as a FileProvider implementation so the camera can share a Uri with the app. For example:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<!-- features and permissions needed in order to use the camera and read/write photos -->
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:label="${PRODUCT_NAME}"
android:name=".AndroidAppMain"
android:supportsRtl="true"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- needed in order for the camera to be able to share the photo with the app -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>

In addition to editing the manifest, you must also manually create the xml/file_paths reference from the manifest’s provider. This is done by creating the folder Android/app/src/main/res/xml in your Skip project and adding a file file_paths.xml with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="my_images" path="." />
<cache-path name="*" path="." />
</paths>

For an example of a properly configured project, see the Photo Chat sample application.

The View.withDocumentPicker(isPresented: Binding<Bool>, allowedContentTypes: [UTType], selectedDocumentURL: Binding<URL?>, selectedFilename: Binding<String?>, selectedFileMimeType: Binding<String?>) extension function can be used to select a document of the specified UTType from the device to use in the App.

On iOS it will use an instance of FileImporter to display the system file picker, essentially allowing to select a file from the Files application, while on Android it relies on the the system document picker via the Activity result for the ACTION_OPEN_DOCUMENT. Once the user selects a file it will receive an uri, that need to be parsed to be used outside the scope of the caller. For doing so it will copy the file inside the App cache folder and expose the cached url instead of the original picked file url.

For example:

Button("Pick Document") {
presentPreview = true
}
.buttonStyle(.borderedProminent)
.withDocumentPicker(isPresented: $presentPreview, allowedContentTypes: [.image, .pdf], selectedDocumentURL: $selectedDocument, selectedFilename: $filename, selectedFileMimeType: $mimeType)

On iOS, files selected through the system document picker are security-scoped — the app is only granted temporary access to read them. The withDocumentPicker modifier acquires and releases this access internally during the picker callback, but your onChange handler runs after the access has already been released. If you need to read or copy the file contents (e.g., importing it into your app’s documents directory), you must re-acquire access in your handler:

.withDocumentPicker(
isPresented: $showPicker,
allowedContentTypes: [.epub],
selectedDocumentURL: $pickedURL,
selectedFilename: $pickedName,
selectedFileMimeType: $pickedType
)
.onChange(of: pickedURL) { oldURL, newURL in
guard let url = newURL else { return }
pickedURL = nil
Task {
#if !SKIP
// Re-acquire security-scoped access for the picked file.
// Without this, file operations like copy or read will fail
// with a "you don't have permission to view it" error.
let accessing = url.startAccessingSecurityScopedResource()
defer { if accessing { url.stopAccessingSecurityScopedResource() } }
#endif
await importFile(from: url)
}
}

This is only needed on iOS — Android handles file access differently by copying the selected file to the app’s cache directory before returning the URL, so the #if !SKIP guard ensures the security-scoped calls are skipped on Android.

If you only need to display the file (e.g., pass it to a DocumentPreview) without reading its contents, re-acquiring access may not be necessary.

The View.withMailComposer() modifier presents a system email composition interface, allowing users to compose and send emails from within your app.

On iOS, this uses MFMailComposeViewController for in-app email composition with full support for recipients, subject, body (plain text or HTML), and file attachments. On Android, this launches an ACTION_SENDTO intent (or ACTION_SEND/ACTION_SEND_MULTIPLE when attachments are present), which opens the user’s preferred email app.

Before presenting the composer, check if the device can send email:

import SkipKit
if MailComposer.canSendMail() {
// Show compose button
} else {
// Email not available
}
struct EmailView: View {
@State var showComposer = false
var body: some View {
Button("Send Feedback") {
showComposer = true
}
.withMailComposer(
isPresented: $showComposer,
options: MailComposerOptions(
recipients: ["support@example.com"],
subject: "App Feedback",
body: "I'd like to share the following feedback..."
),
onComplete: { result in
switch result {
case .sent: print("Email sent!")
case .saved: print("Draft saved")
case .cancelled: print("Cancelled")
case .failed: print("Failed to send")
case .unknown: print("Unknown result")
}
}
)
}
}
MailComposerOptions(
recipients: ["user@example.com"],
subject: "Welcome!",
body: "<h1>Welcome</h1><p>Thank you for signing up.</p>",
isHTML: true
)
let pdfURL = Bundle.main.url(forResource: "report", withExtension: "pdf")!
MailComposerOptions(
recipients: ["team@example.com"],
subject: "Monthly Report",
body: "Please find the report attached.",
attachments: [
MailAttachment(url: pdfURL, mimeType: "application/pdf", filename: "report.pdf")
]
)

Multiple attachments are supported:

attachments: [
MailAttachment(url: pdfURL, mimeType: "application/pdf", filename: "report.pdf"),
MailAttachment(url: imageURL, mimeType: "image/png", filename: "chart.png")
]
MailComposerOptions(
recipients: ["primary@example.com"],
ccRecipients: ["manager@example.com", "team@example.com"],
bccRecipients: ["archive@example.com"],
subject: "Project Update"
)

MailComposer (static methods):

MethodDescription
canSendMail() -> BoolWhether the device can compose email

MailComposerOptions:

PropertyTypeDefaultDescription
recipients[String][]Primary recipients
ccRecipients[String][]CC recipients
bccRecipients[String][]BCC recipients
subjectString?nilSubject line
bodyString?nilBody text
isHTMLBoolfalseWhether body is HTML
attachments[MailAttachment][]File attachments

MailAttachment:

PropertyTypeDescription
urlURLFile URL of the attachment
mimeTypeStringMIME type (e.g. "application/pdf")
filenameStringDisplay filename

MailComposerResult (enum): sent, saved, cancelled, failed, unknown

The View.withDocumentPreview(isPresented: Binding<Bool>, documentURL: URL?, filename: String?, type: String?) extension function can be used to preview a document available to the app (either selected with the provided Document Picker or downloaded locally by the App). On iOS it will use an instance of QLPreviewController to display the file at the provided url while on Android it will open an Intent chooser for selecting the appropriate app for the provided file mime type. On iOS there’s no need to provide a filename or a mime type, but sometimes on Android is necessary (for example when selecting a document using the document picker). On Android if no mime type is supplied it will try to guess it by the file url. If no mime type can be found the application chooser will be empty. A file provider (like the one used for using the MediaPicker) is necessary for the Intent to correctly pass reading permission to the receiving app. As long as your Skip already implements the FileProvider and the file_paths.xml as described in the Camera and Media Permission section there’s nothing else needed, otherwise you need to follow the instructions in the mentioned section.

For cases where you want to display a web page without the full power and complexity of an embedded WebView (from SkipWeb), SkipKit provides the View.openWebBrowser() modifier. This opens a URL in the platform’s native in-app browser:

  • iOS: SFSafariViewController — a full-featured Safari experience presented within your app, complete with the address bar, share sheet, and reader mode.
  • Android: Chrome Custom Tabs — a Chrome-powered browsing experience that shares cookies, autofill, and saved passwords with the user’s browser.

Open a URL in the platform’s native in-app browser:

import SwiftUI
import SkipKit
struct MyView: View {
@State var showPage = false
var body: some View {
Button("Open Documentation") {
showPage = true
}
.openWebBrowser(
isPresented: $showPage,
url: "https://skip.dev/docs",
mode: .embeddedBrowser(params: nil)
)
}
}

To open the URL in the user’s default browser app instead of an in-app browser:

Button("Open in Safari / Chrome") {
showPage = true
}
.openWebBrowser(
isPresented: $showPage,
url: "https://skip.dev",
mode: .launchBrowser
)

By default the embedded browser slides up vertically as a modal sheet. Set presentationMode to .navigation for a horizontal slide transition that feels like a navigation push:

Button("Open with Navigation Style") {
showPage = true
}
.openWebBrowser(
isPresented: $showPage,
url: "https://skip.dev",
mode: .embeddedBrowser(params: EmbeddedParams(
presentationMode: .navigation
))
)
ModeiOSAndroid
.sheet (default)Full-screen cover (slides up vertically)Partial Custom Tabs bottom sheet (resizable, initially half-screen height). Falls back to full-screen if the browser does not support partial tabs.
.navigationNavigation push (slides in horizontally)Standard full-screen Chrome Custom Tabs launch

Limitations:

  • iOS: The .navigation presentation mode requires the calling view to be inside a NavigationStack (or NavigationView). If the view is not hosted in a navigation container, the modifier will have no effect.
  • Android: In .sheet mode, if the user’s browser does not support the Partial Custom Tabs API, the tab launches full-screen as a fallback.

Add custom actions that appear in the share sheet (iOS) or as menu items (Android):

Button("Open with Actions") {
showPage = true
}
.openWebBrowser(
isPresented: $showPage,
url: "https://skip.dev",
mode: .embeddedBrowser(params: EmbeddedParams(
customActions: [
WebBrowserAction(label: "Copy Link") { url in
// handle the action with the current page URL
},
WebBrowserAction(label: "Bookmark") { url in
// save the URL
}
]
))
)

On iOS, custom actions appear as UIActivity items in the Safari share sheet. On Android, they appear as menu items in Chrome Custom Tabs (maximum 5 items).

/// Controls how the embedded browser is presented.
public enum WebBrowserPresentationMode {
/// Present as a vertically-sliding modal sheet (default).
case sheet
/// Present as a horizontally-sliding navigation push.
case navigation
}
/// The mode for opening a web page.
public enum WebBrowserMode {
/// Open the URL in the system's default browser application.
case launchBrowser
/// Open the URL in an embedded browser within the app.
case embeddedBrowser(params: EmbeddedParams?)
}
/// Configuration for the embedded browser.
public struct EmbeddedParams {
public var presentationMode: WebBrowserPresentationMode
public var customActions: [WebBrowserAction]
}
/// A custom action available on a web page.
public struct WebBrowserAction {
public let label: String
public let handler: (URL) -> Void
}
/// View modifier to open a web page.
extension View {
public func openWebBrowser(
isPresented: Binding<Bool>,
url: String,
mode: WebBrowserMode
) -> some View
}

SkipKit provides a cross-platform haptic feedback API that works identically on iOS and Android. You define patterns using simple, platform-independent types, and SkipKit handles playback using CoreHaptics on iOS and VibrationEffect.Composition on Android.

SkipKit includes a set of predefined patterns for common feedback scenarios:

import SkipKit
// Light tap for picking up a draggable element
HapticFeedback.play(.pick)
// Quick double-tick when snapping to a grid
HapticFeedback.play(.snap)
// Solid tap when placing an element
HapticFeedback.play(.place)
// Confirmation feedback
HapticFeedback.play(.success)
// Bouncy celebration for clearing a line or completing a task
HapticFeedback.play(.celebrate)
// Bigger celebration with escalating intensity
HapticFeedback.play(.bigCelebrate)
// Warning for an invalid action
HapticFeedback.play(.warning)
// Error feedback with three descending taps
HapticFeedback.play(.error)
// Heavy impact for collisions
HapticFeedback.play(.impact)

Some patterns adjust based on parameters. The combo pattern escalates in intensity and length with higher streak counts, and finishes with a proportionally heavy thud:

// A 2x combo: two quick taps + light thud
HapticFeedback.play(.combo(streak: 2))
// A 5x combo: five escalating taps + heavy thud
HapticFeedback.play(.combo(streak: 5))
// Bouncing pattern with 4 taps of decreasing intensity
HapticFeedback.play(.bounce(count: 4, startIntensity: 0.9))

You can define your own patterns using HapticEvent and HapticPattern. Each event has a type, intensity (0.0 to 1.0), and delay in seconds relative to the previous event:

// A custom "power-up" pattern: rising buzz, pause, two sharp taps
let powerUp = HapticPattern([
HapticEvent(.rise, intensity: 0.6),
HapticEvent(.rise, intensity: 1.0, delay: 0.1),
HapticEvent(.tap, intensity: 1.0, delay: 0.15),
HapticEvent(.tap, intensity: 0.8, delay: 0.06),
])
HapticFeedback.play(powerUp)

The available event types are:

TypeDescriptioniOSAndroid
.tapShort, sharp tapCHHapticEvent transient, sharpness 0.7PRIMITIVE_CLICK
.tickSubtle, light tickCHHapticEvent transient, sharpness 1.0PRIMITIVE_TICK
.thudHeavy, deep impactCHHapticEvent transient, sharpness 0.1PRIMITIVE_THUD
.riseIncreasing intensityCHHapticEvent continuousPRIMITIVE_QUICK_RISE
.fallDecreasing intensityCHHapticEvent continuousPRIMITIVE_QUICK_FALL
.lowTickDeep, low-frequency tickCHHapticEvent transient, sharpness 0.3PRIMITIVE_LOW_TICK

To use haptic feedback on Android, your AndroidManifest.xml must include the vibrate permission:

<uses-permission android:name="android.permission.VIBRATE"/>

The VibrationEffect.Composition API requires Android API level 31 (Android 12) or higher. On older devices, haptic calls are silently ignored.

On iOS, HapticFeedback uses a CHHapticEngine instance that is created on first use and restarted automatically if the system reclaims it. Each HapticPattern is converted to a CHHapticPattern with appropriate CHHapticEvent types and parameters. For more details, see Apple’s CoreHaptics documentation.

On Android, patterns are converted to a VibrationEffect.Composition with the corresponding PRIMITIVE_* constants and played through the system Vibrator obtained from VibratorManager. For more details, see Android’s VibrationEffect documentation and the guide on custom haptic effects.

SBOMView is a SwiftUI view that renders a “Software Bill of Materials” (SBOM) screen for your app. It reads SPDX 2.3 JSON files generated by the skip sbom create command and presents the bundled software dependencies as a navigable list, with a detail view for each dependency that shows its license, version, supplier, checksums, and any further packages it pulls in.

It is designed to be dropped straight into a Settings or Preferences screen via a NavigationLink:

import SwiftUI
import SkipKit
struct SettingsView: View {
var body: some View {
Form {
// …other settings…
NavigationLink("Bill of Materials") {
SBOMView(bundle: Bundle.module)
}
}
}
}

Use the skip sbom create command to produce the SPDX files and place them inside the resources of the module that owns the SBOM screen (typically the same module that exposes your app’s settings UI):

skip sbom create

The command produces both sbom-darwin-ios.spdx.json and sbom-linux-android.spdx.json. Drop them into your module’s Resources/ directory and make sure your Package.swift target processes that resources folder:

.target(
name: "MyAppUI",
dependencies: [.product(name: "SkipKit", package: "skip-kit")],
resources: [.process("Resources")]
)

SBOMView supports two display modes via the SBOMDisplayMode enum:

  • .hierarchy (default) — Shows only the top-level dependencies (the packages your app depends on directly), and lets the user drill into each one to see its transitive dependencies. The hierarchy is reconstructed from the DEPENDS_ON relationships in the SPDX document, so the screen mirrors the actual dependency tree of your app.
  • .flat — Shows every package in the SBOM as a single alphabetised list, regardless of where it sits in the dependency tree. This is useful for audits, search-and-find workflows, or for showing a complete catalogue of every binary that ends up in your app.
// Hierarchy view (the default): top-level deps only, drill in for transitives
NavigationLink("Bill of Materials") {
SBOMView(bundle: Bundle.module)
}
// Flat view: every package, sorted alphabetically
NavigationLink("All Dependencies") {
SBOMView(bundle: Bundle.module, displayMode: .flat)
}

In both modes the dependency lists are sorted alphabetically by package name (case-insensitive) for predictable presentation.

The summary list shows each dependency’s name, supplier, version, and declared license. Tapping a row pushes a detail view that includes:

  • Package — name, version, supplier, originator, purpose, SPDX ID
  • License — declared and concluded licenses, copyright text, and a “View License on spdx.org” button that opens the corresponding page on spdx.org/licenses (e.g. tapping EUPL-1.2 opens https://spdx.org/licenses/EUPL-1.2.html) inside an in-app browser (SFSafariViewController on iOS, Chrome Custom Tabs on Android). For custom licenses identified by LicenseRef-…, the full license text and any “see also” links are displayed inline from the SBOM’s hasExtractedLicensingInfos section.
  • Dependencies — the direct sub-dependencies of this package, each as a navigation link to its own detail view. This is what makes the hierarchy view navigable: you start at your top-level deps and walk down through the tree.
  • Source — download location, homepage, description, summary
  • External Referencespurl, swiftpm, and other SPDX external refs
  • Checksums — SHA-1 / SHA-256 / etc. for each package archive

The summary list also includes a “Share Bill of Materials” button that brings up the system share sheet so users (or auditors) can export the raw SPDX JSON for offline review.

The same SPDX model used by SBOMView is also exposed for direct use, which is handy for tests, custom UI, or build-time tooling:

if let document = try SBOMDocument.load(from: Bundle.module) {
for package in document.topLevelPackages {
print("\(package.name ?? "?") \(package.versionInfo ?? "")")
print(" License: \(package.licenseDeclared ?? "NOASSERTION")")
for dep in document.directDependencies(of: package) {
print(" └── \(dep.name ?? "?")")
}
}
}

The SPDXLicense helper provides utilities for working with SPDX license identifiers, including extracting a canonical id from compound expressions like LGPL-3.0-only WITH LGPL-3.0-linking-exception and constructing the corresponding https://spdx.org/licenses/<id>.html URL:

SPDXLicense.licensePageURL(for: "EUPL-1.2")
// → https://spdx.org/licenses/EUPL-1.2.html
SPDXLicense.canonicalIdentifier("MIT OR Apache-2.0")
// → "MIT"
SPDXLicense.isUnknown("NOASSERTION")
// → true

This project is a Swift Package Manager module that uses the Skip plugin to transpile Swift into Kotlin.

The module can be tested using the standard swift test command or by running the test target for the macOS destination in Xcode, which will run the Swift tests as well as the transpiled Kotlin JUnit tests in the Robolectric Android simulation environment.

Parity testing can be performed with skip test, which will output a table of the test results for both platforms.

We welcome contributions to this package in the form of enhancements and bug fixes.

The general flow for contributing to this and any other Skip package is:

  1. Fork this repository and enable actions from the “Actions” tab
  2. Check out your fork locally
  3. When developing alongside a Skip app, add the package to a shared workspace to see your changes incorporated in the app
  4. Push your changes to your fork and ensure the CI checks all pass in the Actions tab
  5. Add your name to the Skip Contributor Agreement
  6. Open a Pull Request from your fork with a description of your changes