Skip to content

A (potentially) cross-platform, declarative and immutable Swift library for building user interfaces

License

Notifications You must be signed in to change notification settings

guidomb/PortalView

Repository files navigation

PortalView

Swift Carthage compatible Platform License

A (potentially) cross-platform, declarative and immutable Swift library for building user interfaces.

WARNING!: This is still a work-in-progress, although the minimum features are available to create real world applications the API is still under design and some key optimizations are still missing. Use at your own risk.

TL; DR;

  • Declarative API inspired by Elm and React.
  • 100% in Swift and decoupled from UIKit which makes it (potentially) cross-platform.
  • Uses facebook's Yoga. A cross-platform layout engine that implements Flexbox which is used by ReactNative.
  • Leverage the Swift compiler in order to have a strongly type-safe API.

Here is a sneak peak of the API but you can also check this examples or read the library overview to learn more about the main concepts.

enum Message {

  case like
  case goToDetailScreen

}

let component: Component<Message> = container(
  children: [
    label(
      text: "Hello PortalView!",
      style: labelStyleSheet() { base, label in
          base.backgroundColor = .white
          label.textColor = .red
          label.textSize = 12
      },
      layout: layout() {
          $0.flex = flex() {
              $0.grow = .one
          }
          $0.justifyContent = .flexEnd
      }
    )
    button(
      properties: properties() {
          $0.text = "Tap to like!"
          $0.onTap = .like
      }
    )
    button(
      properties: properties() {
          $0.text = "Tap to got to detail screen"
          $0.onTap = .goToDetailScreen
      }
    )
  ]
)

Installation

Carthage

Install Carthage first by either using the official .pkg installer for the latest release or If you use Homebrew execute the following commands:

brew update
brew install carthage

Once Carthage is installed add the following entry to your Cartfile

github "guidomb/PortalView" "master"

Manual

TODO

Example

For some examples on how the API looks like and how to use this library check

  • The examples project in this repository.
  • This example project
  • The following video

PortalView live reload example

Documentation

PortalView is still a work-in-progress. Documentation will be added as the library matures inside the Documentation directory. You can read the library overview to learn more about the main concepts.

Contribute

Setup

Install Carthage first, then run

git clone [email protected]:guidomb/PortalView.git
cd PortalView
script/bootstrap
open PortalView.xcworkspace

About

A (potentially) cross-platform, declarative and immutable Swift library for building user interfaces

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages