AdminCore, as used in gnorium.com
Core functionality for an admin console for Swift-based web applications.
AdminCore provides a structured, type-safe API for defining and rendering administrative interfaces in Swift. It allows developers to register models using the ModelAdmin protocol and automatically generates dashboards, forms, and editors.
- Declarative Configuration: Define admin interfaces using the
ModelAdminprotocol. - Pre-built Views: Ready-to-use components for dashboards, login, and markdown editing.
- Interactivity: Built-in WebAssembly (WASM) hydration for client-side behaviors.
- Integration: Seamlessly works with
HTMLBuilder,CSSBuilder, andDesignTokens.
Add AdminCore to your Package.swift:
dependencies: [
.package(url: "https://github.com/gnorium/admin-core", branch: "main")
]Then add it to your target dependencies:
.target(
name: "YourTarget",
dependencies: [
.product(name: "AdminCore", package: "admin-core")
]
)import AdminCore
struct ArticleAdmin: ModelAdmin {
let modelName = "Article"
let modelNamePlural = "Articles"
let listFields = ["title", "slug", "status", "createdAt"]
var editFields: [FieldConfig] {
[
.text(name: "title", label: "Title"),
.slug(name: "slug", label: "Slug", sourceField: "title"),
.markdown(name: "content", label: "Body Content")
]
}
}
// In your application logic:
Registry.shared.register(ArticleAdmin())- Swift 6.2+
Apache License 2.0 - See LICENSE for details
Contributions welcome! Please open an issue or submit a pull request.
- design-tokens - Universal design tokens based on Apple HIG
- diff-engine - Platform-agnostic character-level diff engine
- embedded-swift-utilities - Utility functions for Embedded Swift environments
- markdown-utilities - Markdown rendering with media attribution support
- web-apis - Web API implementations for Swift WebAssembly
- web-builders - HTML, CSS, JS, and SVG DSL builders
- web-components - Reusable UI components for web applications
- web-formats - Structured data format builders
- web-security - Portable security utilities for web applications
- web-types - Shared web types and design tokens