Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Swift 3.0 and RAC 5.0, remove UI Extensions #159

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

iv-mexx
Copy link
Member

@iv-mexx iv-mexx commented Oct 31, 2016

First of sorry that theres so much in this one Pull Request at once.

  • Update to Swift 3.0
  • Update to RAC 5.0
  • Removal of UIKit/AppKit Extensions and some other little things that are now already part of RAC

I tried to separate these out, but it is all intertwined, Swift 3.0 required RAC 5.0, and then converting all those methods that would be removed in the next step anyway seemed like unnecessary work.

Open Question

Theres two RACSignal extensions:

  • RACSignal.rex_toSignal()
  • RACSignal.rex_toTriggerSignal()

For now I was hesitant to require ReactiveObjC/ReactiveObjCBridge just for those two extensions...

  • ReactiveObjCBridge only contains a toSignalProducer and no toSignal. Either we could add toSignal to the bridge as well, or just remove this conversion?
  • rex_toTriggerSignal was mostly used internally to convert use rac_willDealloc as a trigger, which now is not necessary anymore with Lifetime.

Complete List of Removals

Those are all documented in Deprecations+Removals.swift, but this list here could also be used in the change log for the next release.

Removals

RAC Extensions

  • Removed Action.rex_enabledProducer. Use Action.reactive.isEnabled instead.
  • Removed Action.rex_executingProducer. Use Action.reacitve.isExecuting instead.

Foundation Extensions

  • Removed NSObject.rex_producerForKeyPath. Use NSObject.reactive.values(forKeyPath:) instead.
  • Removed NSObject.rex_willDealloc. Use NSObject.reactive.lifetime.ended instead.

UIKit Extensions

  • Removed Reusable protocol, use Reusable protocol from RAC instead
    • Removed UITableViewCell.rex_prepareForReuse. Use UITableViewCell.reactive.prepareForReuse instead.
    • Removed UITableViewHeaderFooterCell.rex_prepareForReuse. Use UITableViewHeaderFooterCell.reactive.prepareForReuse instead.
    • Removed UICollectionReusableView.rex_prepareForReuse. Use UICollectionReusableView.reactive.prepareForReuse instead.
  • Removed UIControl.rex_enabled. Use UIControl.reactive.isEnabled instead
  • Removed UIControl.rex_selected. Use UIControl.reactive.isSelected instead
  • Removed UIControl.rex_highlighted. Use UIControl.reactive.isHighlighted instead
  • Removed UIActivityIndicatorView.rex_animating. Use UIActivityIndicatorView.reactive.isAnimating instead.
  • Removed UIBarButtonItem.rex_action. Use UIBarButtonItem.reactive.pressed instead.
  • Removed UIBarItem.rex_enabled. Use UIBarItem.reactive.isEnabled instead.
  • Removed UIButton.rex_pressed. Use UIButton.reactive.pressed instead.
  • Removed UIButton.rex_title. Use UIButton.reactive.title instead.
  • Removed UIDatePicker. use UIDatePicker.reactive.date or UIDatePicker.reactive.dates instead.
  • Removed UIImageView.rex_image. Use UIImageView.reactive.image instead.
  • Removed UIImageView.rex_highlightedImage. Use UIImageView.reactive.highlightedImage instead.
  • Removed UILabel.rex_text. Use UILabe.reactive.text instead.
  • Removed UILabel.rex_attributedText. Use UILabe.reactive.attributedText instead.
  • Removed UILabel.rex_textColor. Use UILabe.reactive.textColor instead.
  • Removed UIProgressView.rex_progress. Use UIProgressView.reactive.progress instead.
  • Removed UISegmentedControl.rex_selectedSegmentIndex. Use UISegmentedControl.reactive.segmentedSegmentIndexes or UISegmentedControl.reactive.segmentedSegmentIndex instead.
  • Removed UISwitch.rex_on. Use UISwitch.reactive.isOn or UISwitch.reactive.isOnValues instead.
  • Removed UITextField.rex_text. Use UITextField.reactive.text, UITextField.reactive.textValues or UITextField.reactive.continuousTextValues instead.
  • Removed UITextView.rex_text. Use UITextView.reactive.text, UITextView.reactive.textValues or UITextView.reactive.continuousTextValues instead.
  • Removed UIView.rex_alpha. Use UIView.reactive.alpha instead.
  • Removed UIView.rex_hidden. Use UIView.reactive.isHidden instead.
  • Removed UIView.rex_userInteractionEnabled. Use UIView.reactive.isUserInteractionEnabled instead.

AppKit Extensions

  • Removed NSTextField.rex_textSignal. Use NSTextField.reactive.continuousStringValues instead.

Tests

I've kept all the UIKit and AppKit Tests around, but converted them to use the reactive extensions. I've converted them almost completely via quick-fixes to verify that the replacements in Deprecations+Removals.swift work correctly.

@mdiep
Copy link
Contributor

mdiep commented Oct 31, 2016

What's left in Rex at this point? I've been assuming that Rex would disappear with RAC 5.

@iv-mexx
Copy link
Member Author

iv-mexx commented Oct 31, 2016

I'd say left are

Extensions for ReactiveCocoa that may not fit in the core framework.

😄

  • some operators on Signal and SignalProducer that are not in RAC like ignoreError, filterMap, timeoutAfter, muteFor uncollect, groupBy
  • some additional bindings for NSUserDefauls, NSData
  • Signals for UIViewController for view will/did appear/disappear
  • Boolean Properties:
        let lhs = MutableProperty(false), rhs = MutableProperty(false)
        let and = lhs.and(rhs)

Personally, I like (and use) the stuff for properties...

@andersio
Copy link
Member

andersio commented Oct 31, 2016

Signals for UIViewController for view will/did appear/disappear

These are covered by NSObject.reactive.trigger(for:), which takes a selector.

Boolean Properties:

You may achieve this through property composition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants