Jiggicons

SwiftUI

The Jiggicons Swift package for iOS, macOS and visionOS.

In Xcode, choose File → Add Package Dependencies and enter:

https://github.com/adrianabelarde/jiggicons-swift

Or in Package.swift:

Package.swift
.package(url: "https://github.com/adrianabelarde/jiggicons-swift", from: "0.1.0")
InboxView.swift
import SwiftUI
import Jiggicons

struct InboxView: View {
    var body: some View {
        JiggIcon("bell", variant: .solid, size: 28, sound: true, label: "Notifications")
            .foregroundStyle(.primary)
    }
}

Tap the icon and it plays. It works on iOS 15, macOS 12, tvOS 15 and visionOS and later, and follows Reduce Motion.

Parameters

ParameterDefault
variant.outline.outline, .solid, .duotone or .glass. Styles
size24Width and height in points
colornilThe icon’s colour; without it, the view’s .foregroundStyle
soundfalsePlay the icon’s spatial sound with its motion
volume1Sound volume from 0 to 1
trigger.tap.tap, .appear or .none
playWhennilPlays whenever this value changes
labelnilAccessible name. Leave it out when the icon sits next to a visible label. Accessibility

Play from code

Change playWhen to play the icon when something else happens:

@State private var saved = 0

Button { saved += 1 } label: {
    Label {
        Text("Save")
    } icon: {
        JiggIcon("saved", variant: .duotone, trigger: .none, playWhen: saved)
    }
}

Sound

Each sound is made by the same synthesis as on the web, already placed between the two speakers along the path the icon moves, and ships in the package as a small .m4a file. Sounds play through AVAudioPlayer in the ambient category: they mix with music and stay quiet when the phone is set to silent. If your app has set its own audio session, it is left as it is.

JiggiconsAudio.shared.volume = 0.6

Single frames

JiggiconFrame draws one pose of an icon, for previews or your own timing:

if let bell = Jiggicons.icon(named: "bell") {
    JiggiconFrame(icon: bell, variant: .glass, seconds: 0.2)
}

The Swift package has the 80 free icons.