All Projects → nangege → Panda

nangege / Panda

Licence: mit
Panda is an asynchronous render and layout framework which can be used to achieve high performance tableview.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Panda

Core Layout
Flexbox & CSS-style Layout in Swift.
Stars: ✭ 215 (+21.47%)
Mutual labels:  autolayout, layout-engine
Autolayout.js
Apple's Auto Layout and Visual Format Language for javascript (using cassowary constraints)
Stars: ✭ 975 (+450.85%)
Mutual labels:  autolayout, layout-engine
Framelayoutkit
FrameLayoutKit is a super fast and easy to use autolayout kit
Stars: ✭ 53 (-70.06%)
Mutual labels:  autolayout, layout-engine
Index.py
An easy-to-use high-performance asynchronous web framework.
Stars: ✭ 158 (-10.73%)
Mutual labels:  asynchronous
Future.apply
🚀 R package: future.apply - Apply Function to Elements in Parallel using Futures
Stars: ✭ 159 (-10.17%)
Mutual labels:  asynchronous
Lear
Linux Engine for Asset Retrieval - speed-profiled C HTTP server
Stars: ✭ 165 (-6.78%)
Mutual labels:  asynchronous
Thenextquant
Asynchronous driven quantitative trading framework.
Stars: ✭ 172 (-2.82%)
Mutual labels:  asynchronous
Play Redis
Play framework 2 cache plugin as an adapter to redis-server
Stars: ✭ 152 (-14.12%)
Mutual labels:  asynchronous
Devicelayout
📱AutoLayout can be set differently for each device
Stars: ✭ 170 (-3.95%)
Mutual labels:  autolayout
Simplenet
An easy-to-use, event-driven, asynchronous network application framework compiled with Java 11.
Stars: ✭ 164 (-7.34%)
Mutual labels:  asynchronous
Falcon
A high-performance web server for Ruby, supporting HTTP/1, HTTP/2 and TLS.
Stars: ✭ 2,058 (+1062.71%)
Mutual labels:  asynchronous
Denite.nvim
Stars: ✭ 2,014 (+1037.85%)
Mutual labels:  asynchronous
Mesh
A toolkit for Kinetic Web Typography
Stars: ✭ 167 (-5.65%)
Mutual labels:  layout-engine
Webssh
🌱 Web based ssh client
Stars: ✭ 2,520 (+1323.73%)
Mutual labels:  asynchronous
Event Loop
An event loop interface for interoperability in PHP.
Stars: ✭ 170 (-3.95%)
Mutual labels:  asynchronous
Ratelimiter
C# rate limiting utility
Stars: ✭ 159 (-10.17%)
Mutual labels:  asynchronous
Vertx Blueprint Todo Backend
Vert.x Blueprint Project - A reactive todo-backend implementation using Vert.x and various persistence
Stars: ✭ 169 (-4.52%)
Mutual labels:  asynchronous
Muuri React
The layout engine for React
Stars: ✭ 163 (-7.91%)
Mutual labels:  layout-engine
Minotaur
A pythonic, asynchronous, inotify interface
Stars: ✭ 163 (-7.91%)
Mutual labels:  asynchronous
Metasync
Asynchronous Programming Library for JavaScript & Node.js
Stars: ✭ 164 (-7.34%)
Mutual labels:  asynchronous

Panda

Carthage compatible Version Swift 4.0

What is Panda

Panda is an asynchronous render and layout framework which can be used to achieve high performance tableview.

Panda is combined by 3 different component:

  1. Cassowary. Core algorithm for constraint solving
  2. Layoutable. API for 'AutoLayout'
  3. Panda. Asynchronous display node.

Why use Panda

When it comes to asynchronous render,many developr will think about Texture or AsyncDisplayKit, In facet, Panda learned a lot from Texture, Panda's render process can be seen as a simplfy version of Texture. But Panda does have it's advantages.Panda use AutoLayout for frame caculating which makes it easy to learn compared to Texture's Flexbox for iOS developer.Panda is more lightweighted and it's usage is more close to system's API,it just cost little to integration. So,if you love Swift,love AutoLayout ,want a high fps tableview and do't want to cost too much,Panda is for you.

Feature

  • [x] Asynchronously render view
  • [x] AutoLayout similar API with background thread usage ability
  • [x] Comparable with existing UIView subclass
  • [x] High performance
  • [x] Pure Swift implement

Demo

visit PandaDemo for a full demonstration

Requirements

  • iOS 8.0+
  • Swift 4.2
  • Xcode 10.0

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. Install it with the following command:

$ gem install cocoapods

To integrate Panda into your Xcode project using CocoaPods, specify it to a target in your Podfile:

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

target 'MyApp' do
  # your other pod
  # ...
  pod 'PandaKit'
end

Then, run the following command:

$ pod install

open the {Project}.xcworkspace instead of the {Project}.xcodeproj after you installed anything from CocoaPods.

For more information about how to use CocoaPods, see this tutorial.

Carthage

Carthage is a decentralized dependency manager for Cocoa application. To install the carthage tool, you can use Homebrew.

$ brew update
$ brew install carthage

To integrate Panda into your Xcode project using Carthage, specify it in your Cartfile:

github "https://github.com/nangege/Panda" "master"

Then, run the following command to build the Panda framework:

$ carthage update

At last, you need to set up your Xcode project manually to add the Panda,Layoutable and Cassowary framework.

On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.

On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following content:

/usr/local/bin/carthage copy-frameworks

and add the paths to the frameworks you want to use under “Input Files”:

$(SRCROOT)/Carthage/Build/iOS/Panda.framework
$(SRCROOT)/Carthage/Build/iOS/Layoutable.framework
$(SRCROOT)/Carthage/Build/iOS/Cassowary.framework

For more information about how to use Carthage, please see its project page.

Usage

  1. Basic

import both Panda and Layoutable,than just write like UIKit

import Panda
import Layoutable

// initiallize 
let node = ViewNode()
let textNode = TextNode()

// addSubnode
node.addSubnode(textNode)

// update properties
textNode.text = "test"
node.backgroundColor = .red


// Layout
node.size = (100,100)
textNode.center = node

view.addSubview(node.view)

UIKit compare
Panda UIKit
ViewNode UIView
ImageNode UIImageView
TextNode UILabel
ControlNode UIControl
ButtonNode UIButton
StackNode UIStackView
FlowLayout No

There do have some difference to make Panda easy to use.For example ControlNode provides a hitTestSlop to expand hittest area.ButtonNode provides space,layuotAxis,textFirst to make it easy to control layout of Button Image and Text

  1. Background thread usage

if code if running in main thread ,frame and appearance for node will update automaticlly.But if you want to layout from background and cache frame, call layoutIfNeeded() ,then var layoutValues: LayoutValues will be what you want if your node hierarchy is not changed,then just pass it as a parameter to apply(_ layout: LayoutValues) in main thread.

  1. Integrate existing UIView subclass

use LayoutNode as a placeHolder,you can use your own UIView and take advantage of node layout

Example:

  // XXVideoView will be initialized in main thread when first visit
  let videoNode = LayoutNode<XXVideoView> {
    let view = XXVideoView()
    return view
  }
  let node2 = ViewNode()
  node.left == node2.left
  1. Layout

    visit Layoutable for more about Layout API

Tips

  1. The most import thing about performance is TextRender Cache .We need to control TextRender Cache manually now .TextRender provide a default TextRenderCache to cache values. If you enter a tempoory ViewController, call TextRender.activeCache() to create a new cache, and call TextRender.cleanCache(_ identifier) wnen exit from the ViewController or all the cache is not needed.
  2. if allowed,set fixedWidth = true for TextNode .fixedWidth means TextNode's width is not determined by text Size, for example you have constraints like textNode.width = 100, or textNode.xSide = superNode.xSide and superNode's width is determined.This will avoid an extra creation of TextRender and avoid a text layout pass which has a big impact on performance.

Todo

  1. Find a better way to control TextRender cache
  2. Complete StackLayout
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].