Swiftpack.co - FluidGroup/TextureSwiftSupport as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by FluidGroup.
FluidGroup/TextureSwiftSupport 3.19.0
A library that gains Texture(AsyncDisplayKit) more power in Swift.
⭐️ 210
πŸ•“ 22 weeks ago
iOS
.package(url: "https://github.com/FluidGroup/TextureSwiftSupport.git", from: "3.19.0")

TextureSwiftSupport - Gains up your productivity

This is a library to gain Texture(AsyncDisplayKit) more power in Swift.

  • Readable Layout DSL
  • Composable components

And you might need to use TextureBridging to integrate with AutoLayout world in your applications.

Requirements

Swiift 5.3+

The cases of usage in Production

Layout DSL

Using resultBuilders, ASLayoutSpec can be more simply and readable it's like SwiftUI's decralations.

πŸ•ΊπŸ» You want to use this in AutoLayout?

Before


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

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

After

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

  LayoutSpec {
    VStackLayout {
      self.textNode1
      self.textNode2
      self.textNode3
    }
  }
  
}

Wrapping with LayoutSpec enables us to write DSL inside this block.

More complicated example

LayoutSpec {
  if flag {
    VStackLayout {
      HStackLayout(justifyContent: .center) {
        iconNode
          .padding(.top, 24)
          .padding(.bottom, 16)
      }
      .background(gradientNode)
    }
  } else {
    gradientNode
  }
}

⚠️ Please take care of the differences between this DSL and SwiftUI.
This DSL just describes the node's layout. You should avoid to create a new node inside layout.
Since layoutSpecThatFits would be called multiple times.

Layouts

  • Basic Layouts

    • VStackLayout
    • HStackLayout
    • ZStackLayout
    • WrapperLayout
    • AbsoluteLayout
    • CenterLayout
    • RelativeLayout
    • InsetLayout
    • OverlayLayout
    • BackgroundLayout
    • AspectRatioLayout
    • SpacerLayout
  • Advanced Layouts

    • VGridLayout
    • AnyLayout
    • Switch

Modifiers

  • WIP

Composable components

TextureSwiftSupport provides us a lot of components that help to create a new component with compositioning from small components.

Technically, composing increases a number of view or layer in run-time. It might reduce the performance a bit.
But most of the cases, that won't be matters.

  • MaskingNode
  • BackgroundNode
  • OverlayNode
  • PaddingNode
  • WrapperCellNode
  • WrapperNode
  • ShapeLayerNode
  • ShapeRenderingNode
  • InteractiveNode
  • AnyDisplayNode
  • GradientNode

Installation

CocoaPods

pod 'TextureSwiftSupport'

☝️ Technically, podspec describes multiple subspecs, you can install a part of this library what you want.

Author

Muukii [email protected]

GitHub

link
Stars: 210
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Dependencies

Release Notes

3.19.0
22 weeks ago

What's Changed

New Contributors

Full Changelog: https://github.com/FluidGroup/TextureSwiftSupport/compare/3.18.0...3.19.0

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics