Skip to content

Commit

Permalink
Merge pull request #30 from AckeeCZ/new_stuff
Browse files Browse the repository at this point in the history
New stuff
  • Loading branch information
janmisar authored Sep 19, 2018
2 parents 7c3f7e4 + 45fa8ce commit 727ef35
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ACKReactiveExtensions.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
690C440F2141870000C39F46 /* UIImageViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690C440D214186E600C39F46 /* UIImageViewExtensions.swift */; };
691DCED421105D5300F5C06A /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 699B58F01FF52E2D00FFDC91 /* Result.framework */; };
691F8596202A106600DA4FAD /* UIControlExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 691F8595202A106600DA4FAD /* UIControlExtensions.swift */; };
6925243F20D14EC300228289 /* UIViewControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6925243D20D14E7100228289 /* UIViewControllerExtensions.swift */; };
Expand Down Expand Up @@ -107,6 +108,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
690C440D214186E600C39F46 /* UIImageViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIImageViewExtensions.swift; sourceTree = "<group>"; };
691F8593202A0E8000DA4FAD /* RealmObjectExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealmObjectExtensions.swift; sourceTree = "<group>"; };
691F8595202A106600DA4FAD /* UIControlExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIControlExtensions.swift; sourceTree = "<group>"; };
6925243D20D14E7100228289 /* UIViewControllerExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewControllerExtensions.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -368,6 +370,7 @@
698F88002029AE3C0099B8FB /* CALayerExtensions.swift */,
699B58E91FF52DCC00FFDC91 /* TextfieldBinding.swift */,
691F8595202A106600DA4FAD /* UIControlExtensions.swift */,
690C440D214186E600C39F46 /* UIImageViewExtensions.swift */,
698F88062029B3A10099B8FB /* UIStackViewExtensions.swift */,
699C4F862083892300AEEAA1 /* UITableViewExtensions.swift */,
698F88042029B3760099B8FB /* UITextFieldExtensions.swift */,
Expand Down Expand Up @@ -901,6 +904,7 @@
698F87FF2029AE120099B8FB /* UIViewExtensions.swift in Sources */,
698F88052029B3760099B8FB /* UITextFieldExtensions.swift in Sources */,
6925243F20D14EC300228289 /* UIViewControllerExtensions.swift in Sources */,
690C440F2141870000C39F46 /* UIImageViewExtensions.swift in Sources */,
698F88072029B3A10099B8FB /* UIStackViewExtensions.swift in Sources */,
698F88012029AE3C0099B8FB /* CALayerExtensions.swift in Sources */,
699B58EB1FF52DCC00FFDC91 /* TextfieldBinding.swift in Sources */,
Expand Down
5 changes: 5 additions & 0 deletions ACKReactiveExtensions/UIKit/CALayerExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ extension Reactive where Base: CALayer {
public var borderColor: BindingTarget<CGColor> {
return makeBindingTarget { $0.borderColor = $1 }
}

/// Binding that represents `cornerRadius`
public var cornerRadius: BindingTarget<CGFloat> {
return makeBindingTarget { $0.cornerRadius = $1 }
}
}
16 changes: 16 additions & 0 deletions ACKReactiveExtensions/UIKit/UIImageViewExtensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// UIImageViewExtensions.swift
// UIKit
//
// Created by Jakub Olejník on 06/09/2018.
//

import UIKit
import ReactiveSwift
import enum Result.NoError

extension Reactive where Base: UIImageView {
public var imageSignal: Signal<UIImage?, NoError> {
return signal(forKeyPath: "image").map { $0 as? UIImage }
}
}
18 changes: 18 additions & 0 deletions ACKReactiveExtensions/UIKit/UIViewExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,22 @@ extension Reactive where Base: UIView {
base.endEditing(true)
}
}

/// Property that represents `frame`
public var frame: Property<CGRect> {
return Property(initial: base.frame, then: frameSignal)
}

/// Property that represents `bounds`
public var bounds: Property<CGRect> {
return Property(initial: base.bounds, then: boundsSignal)
}

private var frameSignal: Signal<CGRect, NoError> {
return signal(forKeyPath: "frame").filterMap { $0 as? CGRect }
}

private var boundsSignal: Signal<CGRect, NoError> {
return signal(forKeyPath: "bounds").filterMap { $0 as? CGRect }
}
}
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ github "Alamofire/AlamofireImage" "3.3.1"
github "ReactiveCocoa/ReactiveCocoa" "8.0.0"
github "ReactiveCocoa/ReactiveSwift" "4.0.0"
github "antitypical/Result" "4.0.0"
github "ashleymills/Reachability.swift" "v4.2.0"
github "realm/realm-cocoa" "v3.7.6"
github "ashleymills/Reachability.swift" "v4.2.1"
github "realm/realm-cocoa" "v3.8.0"
github "rs/SDWebImage" "4.4.2"
github "thoughtbot/Argo" "v4.1.2"
github "thoughtbot/Runes" "v4.1.1"
Expand Down

0 comments on commit 727ef35

Please sign in to comment.