Skip to content

Repository files navigation

OpenAPP

Swift 5.10 Platforms SPM Compatible CocoaPods Compatible License

OpenAPP is an iOS/macOS AI agent SDK for embedding conversational agents into an app. It includes a provider abstraction, Anthropic streaming provider, tool loop, memory, skills, session persistence, built-in tools, and an optional UIKit overlay UI. The Core implementation has no third-party dependencies; the UIKit ChatPanel uses BODragScroll for panel and nested-list interaction.

Package Shape

The current Swift package exposes one library product:

.product(name: "OpenAPP", package: "OpenAPP")

All public types are imported from the single Swift module:

import OpenAPP

The repository keeps implementation files under Sources/Core and Sources/UI for organization, but these are directories inside the same OpenAPP target. There are not separate OpenAPPCore or OpenAPPUI products in the current package.

Requirements

Integration Minimum OS Notes
Swift Package Manager iOS 13, macOS 12, Mac Catalyst 13.1 Single OpenAPP product
CocoaPods iOS 13, macOS 12, Mac Catalyst 13.1 Single OpenAPP pod
UIKit overlay UI iOS 13, Mac Catalyst 13.1 Shared UIKit implementation on mobile and desktop
  • Swift tools version: 5.10
  • Core has no third-party package dependencies
  • The iOS/Catalyst ChatPanel depends on BODragScroll 1.0.1 or later

Installation

Swift Package Manager

Add the package to your app and depend on the single product:

dependencies: [
    .package(url: "https://github.com/chbo297/OpenAPP.git", from: "0.1.0")
],
targets: [
    .target(
        name: "YourApp",
        dependencies: [
            .product(name: "OpenAPP", package: "OpenAPP")
        ]
    )
]

In Xcode, use File > Add Package Dependencies... and select the OpenAPP product.

Local BODragScroll Development

The Demo project directly references the sibling checkout at ../BODragScroll. The committed root manifest still keeps the released requirement; to make swift build and swift test use that editable checkout too, run:

Scripts/Dependencies/use-local-bodragscroll.sh

The default source path is ../BODragScroll; set BODRAGSCROLL_PATH to use another checkout. Restore the released dependency with:

Scripts/Dependencies/use-released-bodragscroll.sh

CocoaPods

Add OpenAPP to your Podfile:

pod 'OpenAPP', '~> 0.1'

Then run:

pod install

Quick Start

import OpenAPP

let providerCentral = ModelProviderCentral()
await providerCentral.register(
    name: "anthropic",
    provider: AnthropicProvider(
        baseURL: "https://api.anthropic.com",
        apiKey: "sk-ant-xxxxxxxxxxxxxxxxxxxxxxxx",
        models: [
            ModelSpec(id: "claude-sonnet-4-6")
        ]
    )
)

let agent = await AIAgentCentral.default.create(
    name: "main",
    profile: AIAgentProfile(identity: "You are a helpful assistant."),
    providerCentral: providerCentral,
    modelPolicy: ModelPolicy(primary: "anthropic/claude-sonnet-4-6")
)

let session = await agent.createSession(title: "Chat")
let stream = session.sendMessage("What is the capital of France?")

for await event in stream {
    switch event {
    case .streamingContent(let delta):
        print(delta, terminator: "")
    case .toolCallStarted(let call):
        print("\nCalling tool: \(call.name)")
    case .completed(let result):
        print("\nDone: \(result.text)")
    case .error(let error):
        print("Error: \(error.localizedDescription)")
    default:
        break
    }
}

Native macOS apps can use the complete Core API. The overlay UI is UIKit-based and is available on Mac through Mac Catalyst; OpenAPP does not currently ship a separate AppKit overlay.

UIKit Overlay

On iOS and Mac Catalyst, OpenAPP can run as a passthrough overlay window above the host app:

import UIKit
import OpenAPP

let overlay = await OpenAPPOverlay.start(
    in: windowScene,
    agent: agent,
    sessionTitle: "Chat"
)

overlay.show()

For direct embedding, create an OpenAPPViewController, assign an agent, and switch it to an existing session id.

Documentation

Guide Description
Getting Started Installation, provider registration, first session
Architecture Current single-module architecture and runtime flow
Providers ModelProvider, ModelSpec, provider stream events
Tools ToolProtocol, schemas, outputs, tool registration
UI Customization Overlay UI, direct controller use, custom UI

Example App

The shared UIKit demo lives in Examples/iOS/OpenAPPDemo.xcodeproj and runs on iOS as well as Mac Catalyst.

cp Examples/iOS/Resources/config.json.example Examples/iOS/Resources/config.json

Fill in Examples/iOS/Resources/config.json, open the demo project, then choose an iOS destination or My Mac (Mac Catalyst) and run.

To verify the Mac build from the command line:

xcodebuild \
  -project Examples/iOS/OpenAPPDemo.xcodeproj \
  -scheme OpenAPPDemo \
  -configuration Debug \
  -destination 'generic/platform=macOS,variant=Mac Catalyst' \
  CODE_SIGNING_ALLOWED=NO \
  build

License

OpenAPP is released under the Apache 2.0 License. See LICENSE for details.

About

Upgrade your app to an AI application

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages