All Projects → TextureCommunity → Textureswiftsupport

TextureCommunity / Textureswiftsupport

Licence: mit
A library to gain us the DSL to define layout spec in Texture [like SwiftUI]

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Textureswiftsupport

Ascollectionflexlayout
A custom collection layout that allows to use Texture layout specs in ASCollectionNode.
Stars: ✭ 24 (-77.14%)
Mutual labels:  texture
Glslcanvas
Simple tool to load GLSL shaders on HTML Canvas using WebGL
Stars: ✭ 1,067 (+916.19%)
Mutual labels:  texture
Torch Encoding Layer
Deep Texture Encoding Network
Stars: ✭ 80 (-23.81%)
Mutual labels:  texture
Gli
jvm gli
Stars: ✭ 21 (-80%)
Mutual labels:  texture
Emojitexture
A Unity plugin to render Emojis ☺ ❤ 🍆 🍑 to a texture
Stars: ✭ 44 (-58.1%)
Mutual labels:  texture
Dds Ktx
Single header KTX/DDS reader
Stars: ✭ 62 (-40.95%)
Mutual labels:  texture
Imogen
GPU Texture Generator
Stars: ✭ 648 (+517.14%)
Mutual labels:  texture
Dists
IQA: Deep Image Structure and Texture Similarity Metric
Stars: ✭ 101 (-3.81%)
Mutual labels:  texture
Curtainsjs
curtains.js is a lightweight vanilla WebGL javascript library that turns HTML DOM elements into interactive textured planes.
Stars: ✭ 1,039 (+889.52%)
Mutual labels:  texture
Oiio
Reading, writing, and processing images in a wide variety of file formats, using a format-agnostic API, aimed at VFX applications.
Stars: ✭ 1,216 (+1058.1%)
Mutual labels:  texture
Bcnencoder.net
Cross-platform texture encoding libary for .NET. With support for BC1-3/DXT, BC4-5/RGTC and BC7/BPTC compression. Outputs files in ktx or dds formats.
Stars: ✭ 28 (-73.33%)
Mutual labels:  texture
Asdk Demo
Texture(ASDK) - Demo
Stars: ✭ 37 (-64.76%)
Mutual labels:  texture
Upkmanager
Blade and Soul Unreal Engine 3 Package (UPK) Extractor and Rebuilder - View, Export and Import Textures and Sounds. DDS Load and Save in C#.
Stars: ✭ 65 (-38.1%)
Mutual labels:  texture
Rxdatasources Texture
ASTable and ASCollection Data Sources for RxSwift (Texture)
Stars: ✭ 25 (-76.19%)
Mutual labels:  texture
Assetkit
🎨 Modern 2D/3D - Importer • Exporter • Util - Library, also called (AssetIO)
Stars: ✭ 97 (-7.62%)
Mutual labels:  texture
Android 3d Model Viewer
Android OpenGL 2.0 application to view 3D models. Published on Play Store
Stars: ✭ 809 (+670.48%)
Mutual labels:  texture
Ffxiv textools2
WPF Implementation of TexTools
Stars: ✭ 61 (-41.9%)
Mutual labels:  texture
Wechatswift
iOS WeChat App Written in Swift 5.0
Stars: ✭ 102 (-2.86%)
Mutual labels:  texture
Glsleditor
Simple WebGL Fragment Shader Editor
Stars: ✭ 1,345 (+1180.95%)
Mutual labels:  texture
Godot Scraps
Experimental projects for learning the Godot engine
Stars: ✭ 76 (-27.62%)
Mutual labels:  texture

TextureSwiftSupport

TextureSwiftSupport is a support library for Texture
It helps writing the code in Texture with Swift's power.

Requirements

Swiift 5.1+

The cases of usage in Production

LayoutSpecBuilder (Using @_functionBuidler)

Swift5.1 has FunctionBuilder(it's not officially)
With this, we can write layout spec with no more commas. (It's like SwiftUI)

Plain

override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {

  ASStackLayoutSpec(
    direction: .vertical,
    spacing: 0,
    justifyContent: .start,
    alignItems: .start,
    children: [
      textNode1,
      textNode2,
      textNode3,
    ]
  )
  
}

With LayoutSpecBuilder

override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {

  LayoutSpec {
    VStackLayout {
      textNode1
      textNode2
      textNode3
    }
  }
  
}

More complicated

override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
    LayoutSpec {
        VStackLayout {
            HStackLayout {
                InsetLayout {
                    node1
                }
                InsetLayout {
                    node2
                }
            }
            node3
            HStackLayout {
                node4,
                node5,
                node6,
            }
        }
    }
}

SwiftUI-like Method Chain API

Inspiring from SwiftUI.

We can build a node hierarchy with the method chain.

For now, we have only a few methods. (e.g Padding, Overlay, Background)

textNode
  .padding([.vertical], padding: 4)
  .background(backgroundNode)

PropertyWrappers

  • @_NodeLayout

It calls setNeedsLayout() automatically when wrappedValue changed. (⚠️ Experimental Feature) If we set any node to bodyNode, MyNode will relayout automatically.

final class MyNode: ASDisplayNode {

  @_NodeLayout bodyNode: ASDisplayNode?

  override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
    LayoutSpec {
      VStackLayout {
        bodyNode
        ...
      }
    }
  }
}

Composition container

Composition container composes one or more nodes in the container node. It would be helpful when a node needs to adjust in specific use-cases.

Example

let myNode: MyNode = 

let paddedNode: PaddingNode<MyNode> = PaddingNode(
  padding: UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8)
) {
  myNode
}
let myNode: MyNode = 
let gradientNode: MyGradientNode

let composedNode = BackgroundNode(
  child: { myNode },
  background: { gradientNode }
)

Shape display node

  • ShapeLayerNode
    • Uses CALayer to draw
  • ShapeRenderingNode
    • Uses CoreGraphics to draw

Author

Muukii [email protected]

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].