Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
language: objective-c
osx_image: xcode9.1
osx_image: xcode10.1

cache: cocoapods
podfile: Example/Podfile

before_install:
- gem install cocoapods
- pod install --repo-update --project-directory=Example

branches:
only:
- master

script:
- xcodebuild clean -workspace Example/RxCocoa-Texture.xcworkspace -scheme RxCocoa-Texture | xcpretty
- xcodebuild build -sdk iphonesimulator -workspace Example/RxCocoa-Texture.xcworkspace -scheme RxCocoa-Texture CODE_SIGNING_REQUIRED=NO | xcpretty
- xcodebuild clean build test
-workspace Example/RxCocoa-Texture.xcworkspace
-scheme RxCocoa-Texture-Example
-sdk iphonesimulator
-destination 'platform=iOS Simulator,name=iPhone 8,OS=12.0'
-configuration Debug
-enableCodeCoverage YES
CODE_SIGNING_REQUIRED=NO | xcpretty
4 changes: 4 additions & 0 deletions Example/RxCocoa-Texture.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
9B0E1642210DADCF0013EC86 /* RepositoryViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B0E1641210DADCE0013EC86 /* RepositoryViewModel.swift */; };
9B6C23932124EB4200129E2F /* RepositoryViewModel2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B6C23922124EB4200129E2F /* RepositoryViewModel2.swift */; };
9BE3DFE3211E780600816FD9 /* ImageDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE3DFE2211E780500816FD9 /* ImageDownloader.swift */; };
BA5756B9222CC72D00D8CBD9 /* ASDisplayNode+RxSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5756B7222CC72200D8CBD9 /* ASDisplayNode+RxSpec.swift */; };
C2B9E94A4FCBBCFCA86BBE1B /* Pods_RxCocoa_Texture_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30C467A356AD9535ACE740C9 /* Pods_RxCocoa_Texture_Tests.framework */; };
F77E2B9F7CE27BC62474DD2B /* Pods_RxCocoa_Texture_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B64F85DE41A757B8E1C3E68C /* Pods_RxCocoa_Texture_Example.framework */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -84,6 +85,7 @@
9E1C79DA561D40B89763472E /* Pods-RxCocoa-Texture_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxCocoa-Texture_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RxCocoa-Texture_Tests/Pods-RxCocoa-Texture_Tests.debug.xcconfig"; sourceTree = "<group>"; };
A700DE1AE94F129E06542938 /* Pods-RxCocoa-Texture_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxCocoa-Texture_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-RxCocoa-Texture_Example/Pods-RxCocoa-Texture_Example.release.xcconfig"; sourceTree = "<group>"; };
B64F85DE41A757B8E1C3E68C /* Pods_RxCocoa_Texture_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RxCocoa_Texture_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BA5756B7222CC72200D8CBD9 /* ASDisplayNode+RxSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ASDisplayNode+RxSpec.swift"; sourceTree = "<group>"; wrapsLines = 0; };
CB878FDCA4BF09167F15A871 /* Pods-RxCocoa-Texture_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxCocoa-Texture_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RxCocoa-Texture_Tests/Pods-RxCocoa-Texture_Tests.release.xcconfig"; sourceTree = "<group>"; };
D34921410F2445031C571EB1 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
F4C2FBFBDA0CE9B43659AD60 /* Pods-RxCocoa-Texture_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxCocoa-Texture_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RxCocoa-Texture_Example/Pods-RxCocoa-Texture_Example.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -171,6 +173,7 @@
607FACE81AFB9204008FA782 /* Tests */ = {
isa = PBXGroup;
children = (
BA5756B7222CC72200D8CBD9 /* ASDisplayNode+RxSpec.swift */,
9B0E15F7210DA33F0013EC86 /* ASButtonNode+RxSpec.swift */,
9B0E15F8210DA33F0013EC86 /* ASControlNode+RxSpec.swift */,
9B0E15FA210DA33F0013EC86 /* ASEditableTextNode+RxSpec.swift */,
Expand Down Expand Up @@ -510,6 +513,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BA5756B9222CC72D00D8CBD9 /* ASDisplayNode+RxSpec.swift in Sources */,
9B0E1607210DA3E80013EC86 /* ASEditableTextNode+RxSpec.swift in Sources */,
9B0E1606210DA3E50013EC86 /* ASControlNode+RxSpec.swift in Sources */,
9B0E1603210DA3CE0013EC86 /* ASImageNode+RxSpec.swift in Sources */,
Expand Down
65 changes: 65 additions & 0 deletions Example/Tests/ASDisplayNode+RxSpec.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// ASDisplayNode+RxSpec.swift
//
// Created by Kanghoon
// Copyright © 2019 RxSwiftCommunity. All rights reserved.
//

import Quick
import Nimble
import RxTest
import RxSwift
import RxCocoa
import AsyncDisplayKit
@testable import RxCocoa_Texture

class ASDisplayNode_RxExtensionSpec: QuickSpec {

override func spec() {
describe("ASDisplayNode") {
let node1 = ASDisplayNode()
let node2 = ASDisplayNode()
let node3 = ASDisplayNode()

beforeEach {
node1.rx.width.onNext(ASDimension(unit: .points, value: 17.0))
node1.rx.minWidth.onNext(ASDimension(unit: .points, value: 15.0))
node1.rx.maxWidth.onNext(ASDimension(unit: .points, value: 20.0))

node2.rx.height.onNext(ASDimension(unit: .points, value: 17.0))
node2.rx.minHeight.onNext(ASDimension(unit: .points, value: 15.0))
node2.rx.maxHeight.onNext(ASDimension(unit: .points, value: 20.0))

node3.rx.preferredSize.onNext(CGSize(width: 40.0, height: 40.0))
}

it("should has correct width") {
expect(node1.style.width.value).to(equal(17.0))
}

it("should has correct minWidth") {
expect(node1.style.minWidth.value).to(equal(15.0))
}

it("should has correct maxWidth") {
expect(node1.style.maxWidth.value).to(equal(20.0))
}

it("should has correct height") {
expect(node2.style.height.value).to(equal(17.0))
}

it("should has correct minHeight") {
expect(node2.style.minHeight.value).to(equal(15.0))
}

it("should has correct maxHeight") {
expect(node2.style.maxHeight.value).to(equal(20.0))
}

it("should has correct preferredSize") {
expect(node3.style.preferredSize).to(equal(CGSize(width: 40.0, height: 40.0)))
}
}
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![alt text](https://github.com/GeekTree0101/RxCocoa-Texture/blob/master/resources/logo.png)
![alt text](https://github.com/RxSwiftCommunity/RxCocoa-Texture/blob/master/resources/logo.png)

[![CI Status](https://api.travis-ci.org/GeekTree0101/RxCocoa-Texture.svg?branch=master)](https://travis-ci.org/GeekTree0101/RxCocoa-Texture)
[![CI Status](https://api.travis-ci.org/RxSwiftCommunity/RxCocoa-Texture.svg?branch=master)](https://travis-ci.org/GeekTree0101/RxCocoa-Texture)
[![Version](https://img.shields.io/cocoapods/v/RxCocoa-Texture.svg?style=flat)](https://cocoapods.org/pods/RxCocoa-Texture)
[![License](https://img.shields.io/cocoapods/l/RxCocoa-Texture.svg?style=flat)](https://cocoapods.org/pods/RxCocoa-Texture)
[![Platform](https://img.shields.io/cocoapods/p/RxCocoa-Texture.svg?style=flat)](https://cocoapods.org/pods/RxCocoa-Texture)
Expand Down
57 changes: 57 additions & 0 deletions RxCocoa-Texture/Classes/ASDisplayNode+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,63 @@ extension Reactive where Base: ASDisplayNode {
}
}

extension Reactive where Base: ASDisplayNode {

public var width: ASBinder<ASDimension> {
return ASBinder(self.base) { node, width in
node.style.width = width
}
}

public var minWidth: ASBinder<ASDimension> {
return ASBinder(self.base) { node, minWidth in
node.style.minWidth = minWidth
}
}

public var maxWidth: ASBinder<ASDimension> {
return ASBinder(self.base) { node, maxWidth in
node.style.maxWidth = maxWidth
}
}

public var height: ASBinder<ASDimension> {
return ASBinder(self.base) { node, height in
node.style.height = height
}
}

public var minHeight: ASBinder<ASDimension> {
return ASBinder(self.base) { node, minHeight in
node.style.minHeight = minHeight
}
}

public var maxHeight: ASBinder<ASDimension> {
return ASBinder(self.base) { node, maxHeight in
node.style.maxHeight = maxHeight
}
}

public var preferredSize: ASBinder<CGSize> {
return ASBinder(self.base) { node, preferredSize in
node.style.preferredSize = preferredSize
}
}

public var minSize: ASBinder<CGSize> {
return ASBinder(self.base) { node, minSize in
node.style.minSize = minSize
}
}

public var maxSize: ASBinder<CGSize> {
return ASBinder(self.base) { node, maxSize in
node.style.maxSize = maxSize
}
}
}

extension ASDisplayNode {

/**
Expand Down