Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/CodandoTV/CraftD

A Server Driven UI library
https://github.com/CodandoTV/CraftD

android flutter jetpack-compose server-driven-ui swift swiftui

Last synced: 9 days ago
JSON representation

A Server Driven UI library

Awesome Lists containing this project

README

        

[![Android API](https://img.shields.io/badge/api-21%2B-brightgreen.svg?style=for-the-badge)](https://android-arsenal.com/api?level=21)
[![kotlin](https://img.shields.io/github/languages/top/codandotv/craftd.svg?style=for-the-badge&color=blueviolet)](https://kotlinlang.org/)
[![License MIT](https://img.shields.io/github/license/codandotv/craftd.svg?style=for-the-badge&color=orange)](https://opensource.org/licenses/MIT)





CraftD: A framework to implement Server-Driven UI quickly and easily to Android / iOS / Flutter / Kmp

### Documentation
See the [project website](https://codandotv.gitbook.io/craftd) for documentation.

Take a look at [CraftD: Server Driven UI for All Platforms](https://medium.com/codandotv/craftd-server-driven-ui-for-all-platforms-b2624d2c2a7b)

## Features
### 🔗 Compatibility

| Tech | Support |
|---------------------------------|:--------------------:|
| View System - Android | ✅ **Supported** |
| Jetpack Compose - Android | ✅ **Supported** |
| Widget - Flutter | ✅ **Supported** |
| SwiftUi - iOS | ✅ **Supported** |
| Jetpack Compose - Multiplatform | ⚒️ **In Progress** |

### Components that already exist in the library

| Component | Compose | View System | Widget | SwiftUI |
|-----------|----------|----------|----------|----------|
| Button | X | X | X | X |
| Text | X | X | X | X |
| CheckBox | X | - | - | X |

### Create your custom component( android compose example )

```kotlin
@JsonIgnoreProperties(ignoreUnknown = true)
@Immutable
@Stable
data class CheckBoxProperties(
@JsonProperty("text") val text: String? = null,
... rest of your properties
)

```

#### Add your Component json object in Dymanic.json
```json
{
"key": "CraftDCheckBox",
"value": {
... place your properties
}
}

```

#### Create your Component
```kotlin
@Composable
fun CraftDCheckBox(
checkboxProperties: CheckBoxProperties,
modifier: Modifier = Modifier,
onChecked: (Boolean) -> Unit
) {
... place your code
}
```

#### Create your Component Builder
```kotlin
class CraftDCheckBoxBuilder(
override val key: String = CraftDComponentKey.CHECK_BOX_COMPONENT.key
) :
CraftDBuilder {
@Composable
override fun craft(model: SimpleProperties, listener: CraftDViewListener) {
val checkBoxProperties = model.value.convertToVO()
CraftDCheckBox(checkBoxProperties) {
checkBoxProperties.actionProperties?.let { listener.invoke(it) }
}
}
}
```

More details check our [documentation](https://codandotv.gitbook.io/craftd)

### Samples
| [Android Compose](https://github.com/CodandoTV/CraftD/tree/main/android_kmp/app-sample/src/main/java/com/github/codandotv/craftd/app_sample/presentation/compose) | [Android View System](https://github.com/CodandoTV/CraftD/tree/main/android_kmp/app-sample/src/main/java/com/github/codandotv/craftd/app_sample/presentation/xml) | [iOS SwiftUI](https://github.com/CodandoTV/CraftD/tree/main/ios/sample/CraftDSample) | [Flutter](https://github.com/CodandoTV/CraftD/tree/main/flutter/sample/lib) |
|----------|----------|----------|----------|
| | | | |

### Credits

> A Server Driven UI library for Android.

Inspired by the [DynamicView](https://github.com/rviannaoliveira/DynamicView/).

This project exists thanks to all the people who contribute.