This repository contains a working demo application that integrates the Kuzu graph database with iOS. It demonstrates how to properly set up and use the Kuzu C API in a Swift application.
Kuzu is a high-performance graph database management system. This project shows how to:
- Properly integrate the Kuzu.xcframework into an iOS application
- Configure the necessary build settings for successful compilation
- Create a bridging header to access the C API
- Write Swift code that interacts with the Kuzu database
- Xcode 14.0 or later
- iOS 15.0 or later
- The Kuzu.xcframework (must be obtained from github.com/johnbenac/kuzo_ios)
These were critical for getting the library working on iOS:
-
Framework Setup:
- Add Kuzu.xcframework to your project
- Set to "Embed & Sign" in Build Phases
-
Build Settings:
- Add
-lc++
to "Other Linker Flags" - Set Framework Search Paths to include
$(PROJECT_DIR)
- Set Header Search Paths to include
$(PROJECT_DIR)/**
- Add
-
Bridging Header:
- Create a bridging header with
#import <Kuzu/kuzu.h>
- Create a bridging header with
-
Resource Configuration: When initializing the database, use iOS-appropriate resource settings:
let systemConfig = kuzu_system_config( buffer_pool_size: 1024 * 1024 * 16, // 16MB max_num_threads: 1, // Just 1 thread for iOS enable_compression: true, read_only: false, max_db_size: 1024 * 1024 * 64, // 64MB limit auto_checkpoint: true, checkpoint_threshold: 1024 * 1024 // 1MB )
The repository contains a complete working example showing:
- Database initialization
- Creating a schema
- Inserting data
- Querying data
- Proper resource cleanup
- Clone this repository
- Download the Kuzu.xcframework from github.com/johnbenac/kuzo_ios
- Build and run on your iOS device
If you encounter issues:
- Ensure
-lc++
is added to linker flags - Verify framework and header search paths
- Check that your resource settings match iOS capabilities
- Clean build folder and rebuild
[Specify your license here]
- Thanks to the Kuzu Database team for creating this powerful graph database