All Projects → feilfeilundfeil → Cyanic

feilfeilundfeil / Cyanic

Licence: MIT license
Declarative, state-driven UI framework

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Cyanic

Lpdmvvmkit
LPDMvvmKit - Elegant MVVM framework in Objective-C.
Stars: ✭ 400 (+1150%)
Mutual labels:  uitableview, uicollectionview, viewmodel
Hgplaceholders
Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project
Stars: ✭ 2,048 (+6300%)
Mutual labels:  state-management, uitableview, uicollectionview
Gskstretchyheaderview
A generic stretchy header for UITableView and UICollectionView
Stars: ✭ 1,624 (+4975%)
Mutual labels:  uitableview, uicollectionview
Genericdatasource
A generic small reusable components for data source implementation for UITableView/UICollectionView in Swift.
Stars: ✭ 127 (+296.88%)
Mutual labels:  uitableview, uicollectionview
IQListKit
Model driven UITableView/UICollectionView
Stars: ✭ 51 (+59.38%)
Mutual labels:  uitableview, uicollectionview
Carbon
🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.
Stars: ✭ 1,034 (+3131.25%)
Mutual labels:  uitableview, uicollectionview
Basecomponents
BaseComponents aims to provide easily reusable and understandable components to increase productivity with UIKit and Foundation APIs
Stars: ✭ 92 (+187.5%)
Mutual labels:  uitableview, uicollectionview
Vbpiledview
Simple and beautiful stacked UIView to use as a replacement for an UITableView, UIImageView or as a menu
Stars: ✭ 164 (+412.5%)
Mutual labels:  uitableview, uicollectionview
Changeset
Minimal edits from one collection to another
Stars: ✭ 807 (+2421.88%)
Mutual labels:  uitableview, uicollectionview
Tabanimated
A skeleton screen framework based on native for iOS. (一个由iOS原生组件映射出骨架屏的框架,包含快速植入,低耦合,兼容复杂视图等特点,提供国内主流骨架屏动画的加载方案,同时支持上拉加载更多、自定制动画。)
Stars: ✭ 2,909 (+8990.63%)
Mutual labels:  uitableview, uicollectionview
Flowkit
A declarative type-safe framework for building fast and flexible list with Tables & Collection
Stars: ✭ 215 (+571.88%)
Mutual labels:  uitableview, uicollectionview
Squaremosaiclayout
An extandable mosaic UICollectionViewLayout with a focus on extremely flexible customizations 🔶
Stars: ✭ 243 (+659.38%)
Mutual labels:  uitableview, uicollectionview
Pagingkit
PagingKit provides customizable menu UI. It has more flexible layout and design than the other libraries.
Stars: ✭ 1,030 (+3118.75%)
Mutual labels:  uitableview, uicollectionview
Tangramkit
TangramKit is a powerful iOS UI framework implemented by Swift. It integrates the functions with Android layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView
Stars: ✭ 984 (+2975%)
Mutual labels:  uitableview, uicollectionview
Skeletonview
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
Stars: ✭ 10,804 (+33662.5%)
Mutual labels:  uitableview, uicollectionview
Thinningcoordinator
The UITableView/UICollectionView dataSource/delegate thinning coordinator, help thinning your UIViewController!
Stars: ✭ 25 (-21.87%)
Mutual labels:  uitableview, uicollectionview
Closures
Swifty closures for UIKit and Foundation
Stars: ✭ 1,720 (+5275%)
Mutual labels:  uitableview, uicollectionview
Flix
iOS reusable form library in Swift.
Stars: ✭ 725 (+2165.63%)
Mutual labels:  uitableview, uicollectionview
Viewanimator
ViewAnimator brings your UI to life with just one line
Stars: ✭ 6,592 (+20500%)
Mutual labels:  uitableview, uicollectionview
Rglistkit
RGListKit is a Protocol & MVVM based framework to easily populate a UITableView or UICollectionView via single api.
Stars: ✭ 178 (+456.25%)
Mutual labels:  uitableview, uicollectionview

Cyanic

Cyanic is an iOS framework created at Feil, Feil, & Feil GmbH in response to a need for state-driven UI. It borrows heavily from the concepts of Airbnb's MvRx framework (which our Android developers use) to create a very similar code base with Android thereby unifying the business logic in both platforms. We use this framework to create complex, performant, and reactive screens in our projects.

Cyanic is a Swift only framework. There are no plans to make it compatible with Objective-C.

Installation

CocoaPods

Requirements:

  • Swift 5.0+
  • iOS 10.0+
  1. Add the following to your Podfile:

    pod 'Cyanic'
    pod 'LayoutKit', :git => 'https://github.com/hooliooo/LayoutKit.git' // Use this fork until LayoutKit is updated
  2. Integrate your dependencies using frameworks: add use_frameworks! to your Podfile.

  3. Run pod install.

Why we use a forked version of LayoutKit

LayoutKit is the library that is responsible for most of the UI logic in Cyanic. However, as of April 17, 2019, there are some limitations to the current LayoutKit version in Cocoapods:

  1. It is not updated to use Swift 5
  2. Cyanic needs access to an internal initializer of the Layouts that allows you to declare the UIView subclass type as an argument.

Without these changes, Cyanic will continue to use the forked version.

Documentation

Check out our wiki for full documentation.

A Simple Example

A very simple example with expandable functionality:

struct YourState: ExpandableState {
    
    enum Section: String, CaseIterable {
        case first
        case second
    }

    static var `default`: YourState { 
        return YourState(
            text: "Hello, World!",
            expandableDict: YourState.Section.allCases.map { $0.rawValue }
                .reduce(into: [String: Bool](), { (current: inout [String: Bool], id: String) -> Void in
                    current[id] = false
                }
        ) 
    } 

    var text: String
    var expandableDict: [String: Bool]
}

class YourViewModel: ViewModel<YourState> {
    func showCyanic() {
        self.setState { $0.text = "Hello, Cyanic!" }
    }
}

class YourComponentViewController: SingleSectionCollectionComponentViewController {
    
    private let viewModel: YourViewModel = YourViewModel(initialState: YourState.default)
    
    override var viewModels: [AnyViewModel] {
        return [self.viewModel.asAnyViewModel]
    }
    
    override func buildComponents(_ componentsController: inout ComponentsController) {
        withState(self.viewModel) { (state: YourState) -> Void in
            componentsController.staticTextComponent {
                $0.id = "title"
                $0.text = state.text
            }
            
            componentsController.buttonComponent {
                $0.id = "button"
                $0.onTap = { [weak self]
                    self?.viewModel.showCyanic()
                }
            }
            
            let firstExpandableID: String = YourState.Section.first.rawValue
            
            let yourExpandable = components.expandableComponent { [weak self] in
                guard let s = self else { return }
                $0.id = firstExpandableID
                $0.contentLayout = LabelContentLayout(text: Text.unattributed("Hello, World!"))
                $0.isExpanded = state.expandableDict[firstExpandableID] ?? false
                $0.setExpandableState = self.viewModel.setExpandableState
                $0.backgroundColor = UIColor.lightGray
                $0.height = 55.0
            }
            
            // These ButtonComponents will only show up when yourExpandable is expanded.
            if yourExpandable.isExpanded {
                for number in 1...5 {
                    componentsController.buttonComponent {
                        $0.id = "button\(number)"
                        $0.title = "\(number)"
                        $0.onTap = { [weak self]
                            print("Hello, World from Button \(number)")
                        }
                    }
                }
            }
        }
    }
}

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].