Contents

niksativa/idkit

Simple and lightweight library that provides a set of classes and functions to work with identifiers.

Known issue: **SwiftUI+Preview** crash

Based on bug in SwiftUI+Preview that is crashing when using ForEach with IDContract models which conforms Identifiable by default It's a bug in SwiftUI+Preview, not in this package. Some times it works, but sometimes it crashes...

  • ⚠️ If you don't use SwiftUI+Preview, then you definitely won't need this code!
  • This is a workaround to fix the crash and show SwiftUI+Preview. You can use Simulator without that workaround to avoid this crash.
  • Xcode 15.4 is still crashing, waiting for a fix in Xcode 16.0... or in future versions from Apple 🤷‍♂️

Usage

ForEach(.fixID($items)) { item in
    // take the properties from the item directly
    let some = item.some
    // or
    // take the original item
    let item = item.original
}

Crash log

== PREVIEW UPDATE ERROR:

LinkDylibError: Failed to build RoutesView.swift

Linking failed: linker command failed with exit code 1 (use -v to see invocation)

ld: warning: search path '/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator' not found
ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
Undefined symbols for architecture arm64:
"nominal type descriptor for IDKit.TypedID", referenced from:

Package Metadata

Repository: niksativa/idkit

Default branch: main

README: README.md