maxwelldesign / lux

Open UI Look development framework for SwiftUI, iOS + macOS
http://maxwell.design
GNU General Public License v3.0
14 stars 3 forks source link

MAXWELL L U X makes app development faster (and magic)! Craft customized UI Design Systems ready to be used in SwiftUI—even if you’re not a design expert!

⚠️ To use with Swift 5.x. Please ensure you are using >= 5.1.0 ⚠️

Contents

Requirements

Communication

Installation

SPM

Swift Package Manager is a dependency manager for Cocoa projects.

You can install Lux by importing this repo's url into Xcode.

https://github.com/maxwelldesign/lux

CocoaPods

Notice: There are some known issues with CocoaPods and Xcode-Canvas. Whenever possible, please prefer the SPM install option. Experimental LUX import as SPM package inside a CocoaPods project has been successful.

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build Lux 1.0.0+.

To integrate Lux into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'Lux', '~> 1.0.0'
end

Then, run the following command:

$ pod install

Usage

Quick Start

import SwiftUI
import Lux

struct ContentView: View {

    var body: some View{
      Column{
        Row{
          Text("Hello World")
          .lux
          .trait(.title)
          .style(.paragraph)
          .view
        }
      }
      .lux
      .style(.panel)
      .feature(.padding, .shadow,)
      .card
      .view
    }

}

Specification

Install the Maxwell App to create LUX specifications. It's available for iOS and macOS from the MAXWELL DESIGN website:

From the Maxwell App:

Note: If you are in the simulator, use "Get Pasteboard" from the menu to transmit the data to macOS.

Once ready, open Xcode and paste the configuration code BEFORE attaching your views, ideally in the Scene Delegate, ie:

 func initializeLook(){
        do{
            try Look.set(data64:" SOME DATA")
        }catch{
            print("error")
        }
  }

Stream

You can tweak any LUX powered application in realtime from the MAXWELL APP.

Add this to your launch code:

 func tuneLux(){
        Look.tunning()
  }

Then to dynamically update any view simple add this Observable definition for the global Look state:

struct ContentView: View {
    @ObservedObject var state = Look.state
    ...

Note: You can name it in any way.

Playground

You can try Lux in Playground.

Note:

To try Lux in playground, open Lux.xcworkspace and build Lux.framework for any simulator first.


Resources

Learning

Install the Maxwell App and purchase a research license to its Full Source Code. Some interesting features:

The entire Maxwell App is based on a (flavored) MVVC pattern over Combine + SwiftUI. Don't miss the chance to look into one of the first large scale apps built on the SwiftUI era!

Credits

License

LUX is released under the GNU GPL license. See LICENSE for details.

Contact lux@maxwell.design for flexible licensing options and other inqueries.