Skip to content

andyfinnell/NativeComponentKit

Repository files navigation

NativeComponentKit

Tests Swift Package Manager compatible

NativeComponentKit is a testbed for experimenting with internal plugin systems. Its goal is to solve large-team problems, where the app needs to be divided into vertical feature slices using hard boundaries. The framework defines infrastructure that allows one vertical slice to share components with another vertical slice without explicitly coupling them.

NativeComponentKit supports iOS, macOS, and tvOS.

The NativeComponentTestApp is the macOS/iOS test app for this framework.

Goals

  • Have the app embed an opaque component (e.g. a banner at the top of the window)
  • Have the app embed a collection of components (maybe collection view of product cards)
  • Have the app embed single/collection of components where API response doesn't have component ID (since service may be oblivious to our component concept)
  • Have the app embed a component where the fields have to be requested (e.g. fetch a banner via GraphQL)
  • Have the app embed a component where the API defines the UI; views and layout (e.g. the component kit becomes a view renderer)
  • Have the app embed a component where the API defines the UI and further API calls (e.g. API can define a form that the component kit can render)

Requirements

  • Swift 5.2 or greater
  • iOS/tvOS 13 or greater OR macOS 10.15 or greater

Installation

Currently, NativeComponentKit is only available as a Swift Package.

...using a Package.swift file

Open the Package.swift file and edit it:

  1. Add NativeComponentKit repo to the dependencies array.
  2. Add NativeComponentKit as a dependency of the target that will use it
// swift-tools-version:5.2

import PackageDescription

let package = Package(
  // ...snip...
  dependencies: [
    .package(url: "https://github.com/andyfinnell/NativeComponentKit.git", from: "0.0.1")
  ],
  targets: [
    .target(name: "MyTarget", dependencies: ["NativeComponentKit"])
  ]
)

Then build to pull down the dependencies:

$ swift build

...using Xcode

Use the Swift Packages tab on the project to add NativeComponentKit:

  1. Open the Xcode workspace or project that you want to add NativeComponentKit to
  2. In the file browser, select the project to show the list of projects/targets on the right
  3. In the list of projects/targets on the right, select the project
  4. Select the "Swift Packages" tab
  5. Click on the "+" button to add a package
  6. In the "Choose Package Repository" sheet, search for "https://github.com/andyfinnell/NativeComponentKit.git"
  7. Click "Next"
  8. Choose the version rule you want
  9. Click "Next"
  10. Choose the target you want to add NativeComponentKit to
  11. Click "Finish"

Usage

TBD

About

Plugin system for native Swift iOS and macOS apps

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages