CtrlK
BlogDocsLog inGet started
Tessl Logo

thiennc-tesoglobal/ios-skills

Community-maintained Agent Skills for complete Swift and Apple-platform app delivery.

72

Quality

90%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Medium

Suggest reviewing before use

Overview
Quality
Evals
Security
Files

shazamkit-patterns.mdskills/shazamkit/references/

ShazamKit Patterns and Recipes

Advanced workflows for media synchronization, custom audio catalog packaging, and offline signature processing.

Time-Synchronized Media Alignment

Use SHMatchedMediaItem.matchOffset and frequencySkew to synchronize app UI, video, or lyrics precisely with ambient audio:

import ShazamKit

final class MediaSyncCoordinator: Sendable {
    func synchronize(with match: SHMatchedMediaItem, localVideoPlayer: AnyObject) {
        let offset = match.matchOffset
        let skew = match.frequencySkew ?? 1.0

        // Calculate current playback timestamp
        print("Audio matched at offset: \(offset) seconds with skew factor: \(skew)")
    }
}

Bundling and Loading Pre-compiled Catalogs

Store .shazamcatalog files in the app bundle and initialize SHCustomCatalog at runtime:

import ShazamKit

final class BundledCatalogProvider {
    static func loadCatalog(named name: String) throws -> SHCustomCatalog {
        guard let url = Bundle.main.url(forResource: name, withExtension: "shazamcatalog") else {
            throw CatalogError.fileNotFound
        }

        let customCatalog = SHCustomCatalog()
        try customCatalog.add(from: url)
        return customCatalog
    }

    enum CatalogError: Error {
        case fileNotFound
    }
}

Async Signature Matching with Swift Concurrency

Match single signatures asynchronously using SHSession.match(_:) without needing delegate boilerplate:

import ShazamKit

actor SignatureMatcher {
    private let session: SHSession

    init(catalog: SHCustomCatalog? = nil) {
        if let catalog {
            self.session = SHSession(catalog: catalog)
        } else {
            self.session = SHSession()
        }
    }

    func match(signature: SHSignature) async throws -> SHMatchedMediaItem? {
        let match = try await session.match(signature)
        return match.mediaItems.first
    }
}

Creating Custom Audio Signatures in Background

Batch-process local audio files into signatures on background actors:

import ShazamKit
import AVFAudio

actor OfflineSignatureProcessor {
    func processAudio(at fileURL: URL) throws -> SHSignature {
        let audioFile = try AVAudioFile(forReading: fileURL)
        let generator = SHSignatureGenerator()
        let buffer = AVAudioPCMBuffer(
            pcmFormat: audioFile.processingFormat,
            frameCapacity: 4096
        )!

        while audioFile.framePosition < audioFile.length {
            try audioFile.read(into: buffer)
            try generator.append(buffer, at: nil)
        }

        return generator.signature()
    }
}

skills

.mcp.json

README.md

tile.json