IOS Reactivecocoa most common API collation (can be used as a manual query)

Source: Internet
Author: User
Tags gcd uicontrol

This article is suitable for a certain RAC foundation of children's shoes to do the occasional query, so this article does not do a detailed explanation.

First, Common class

1, RACSIGANL signal class.

Racemptysignal: null signal, used to implement the +empty method of racsignal;

Racreturnsignal: One-yuan signal, used to realize the +return of racsignal: method;

Racdynamicsignal: Dynamic signal, using a block-to implement the subscription behavior, we use the Racsignal +createsignal: method is created by the instance of the class;

Racerrorsignal: Error signal, used to implement Racsignal +error: method;

Racchannelterminal: The channel terminal, which represents a terminal of the Racchannel, is used for two-way binding.

2. Racsubscriber Subscribers

3, racdisposable used to unsubscribe or clean up resources, when the signal is sent to complete or send an error, it will automatically trigger it.

Racserialdisposable: Used as a container for disposable, can contain a disposable object, and allows the disposable object to be exchanged through atomic operations;

Rackvotrampoline: Represents a KVO observation, and can be used to stop observation;

Raccompounddisposable: It can contain multiple disposable objects and supports manual addition and removal of disposable objects

Racscopeddisposable: Calls itself the-dispose method when it is dealloc.

4, Racsubject signal providers, they can act as a signal, but also to send signals.

Racgroupedsignal: Packet signal, used to implement racsignal grouping function;

Racbehaviorsubject: A signal that repeats the last value, and when subscribed, sends the last value it receives to the subscriber;

Racreplaysubject: Repeats the signal, saves the sent value, and, when subscribed, sends the values back to the Subscriber.

5, Ractuple tuple class, similar to Nsarray, used to wrap the value.

6. The collection class in Racsequence RAC

7. Raccommand RAC is used to handle events in the class, can the event how to handle, the event of how the data passed, wrapped in this class, he can easily monitor the execution of the event process.

8, Racmulticastconnection used when a signal, is multiple subscriptions, in order to ensure the creation of a signal, avoid multiple calls to create the block in the signal, causing side effects, you can use this class processing.

9, Racscheduler RAC in the queue, with the GCD package.

Racimmediatescheduler: Perform the scheduled task immediately, which is the only scheduler that supports synchronous execution;

Racqueuescheduler: An abstract queue scheduler that dispatches all tasks asynchronously in a GCD string row;

Ractargetqueuescheduler: Inherits from Racqueuescheduler, asynchronously dispatches all tasks in a serial queue with an arbitrary GCD as target;

Racsubscriptionscheduler: A scheduler that is used only to dispatch subscriptions.

Second, common usage

Rac_signalforselector: Substitute Proxy

Rac_valuesandchangesforkeypath:kvo

Rac_signalforcontrolevents: Monitoring Events

Rac_addobserverforname instead of notification

Rac_textsignal: Listen text box text change

Rac_liftSelector:withSignalsFromArray:Signals: When the incoming signals (signal array), each signal is at least sendnext once, it will trigger the method of the first selector parameter.

Three, common macros

RAC (TARGET, [KeyPath, [Nil_value]]): Used to bind an attribute to an object

Racobserve (self, name): Listens for a property of an object and returns a signal.

@weakify (obj) and @strongify (obj)

Ractuplepack: Wrapping data into ractuple (tuple class)

Ractupleunpack: Unpacking the Ractuple (tuple Class) into corresponding data

Racchannelto a terminal for two-way binding

Iv. Common methods of operation

The Flattenmap map is used to map the source signal content into new content.

Concat combination of signals in a certain sequence, when multiple signals are emitted, sequential reception of signals

Then used to connect two signals, when the first signal is completed, then the signal returned will be connected.

Merge combines multiple signals into a single signal, which is called when any signal has a new value.

The zipwith compresses two signals into a single signal, and the next event of the compressed stream is triggered only when two signals simultaneously emit the signal content, and the contents of the two signals are combined into a single tuple.

Combinelatest: Merging multiple signals and getting the latest values for each signal must have at least one sendnext per merged signal to trigger the combined signal.

Reduce aggregation: The content used for signaling is a tuple that aggregates the values of a signal-emitting tuple into a single value

Filter: Filters the signal and uses it to obtain a signal that satisfies the condition.

Ignore: a signal that ignores certain values.

Distinctuntilchanged: When the last value and the current value have a noticeable change, the signal will be signaled, otherwise it will be ignored.

Take: A total of n times from the beginning of the signal

Takelast: Take the last n times the signal, the precondition, the Subscriber must call to complete, because only completes, will know how many signals in total.

Takeuntil: (racsignal *): get signal until a signal is executed

Skip: (Nsuinteger): Skips a few signals, does not accept.

Switchtolatest: Used for signalofsignals (signal signal), sometimes the signal will also send a signal, in the signalofsignals, to obtain the latest signal sent signalofsignals.

Donext: Before executing Next, the block is executed first

Docompleted: This block is executed before sendcompleted is executed

Timeout: timeout, can let a signal after a certain time, automatic error.

Interval timing: Signals are sent every time

Delay sending next.

Retry Retry: The block in the create signal will be re-executed as long as it fails until it succeeds.

Replay replay: When a signal is subscribed multiple times, the content is repeatedly played

Throttle throttling: When a signal is sent more frequently, you can use throttling, in a certain period of time do not send the signal content, over a period of time to obtain the latest content of the signal issued.

Five, Ui-category (common summary)

1, rac_prepareforreusesignal: Need to reuse

Related Ui:mkannotationview, Uicollectionreusableview, UITableViewCell, Uitableviewheaderfooterview

2. Rac_buttonclickedsignal: Click event Trigger Signal

Related Ui:uiactionsheet, Uialertview

3 , Rac_command:button class, refresh class-related command substitution

Related Ui:uibarbuttonitem, UIButton, Uirefreshcontrol

4. Rac_signalforcontrolevents:control Event Trigger

Related Ui:uicontrol

5, Rac_gesturesignal uigesturerecognizer event processing signal

Related Ui:uigesturerecognizer

6, rac_imageselectedsignal Select the signal of the picture

Related Ui:uiimagepickercontroller

7, Rac_textsignal

Related Ui:uitextfield, Uitextview

8. The relevant API for two-way binding

Rac_channelForControlEvents:key:nilValue:

Related Ui:uicontrol class

Rac_newdatechannelwithnilvalue:

Related Ui:uidatepicker

Rac_newselectedsegmentindexchannelwithnilvalue:

Related Ui:uisegmentedcontrol

Rac_newvaluechannelwithnilvalue:

Related Ui:uislider, Uistepper

Rac_newonchannel

Related Ui:uiswitch

Rac_newtextchannel

Related Ui:uitextfield

Vi. Foundation-category (general summary)

1, Nsarray

Rac_sequence Signal Set

2, NSData

Rac_readContentsOfURL:options:scheduler: More outgoing than OC Setup

3, Nsdictionary

Rac_sequence does not explain

Rac_keysequence Key Collection

Rac_valuesequence Value Collection

4, Nsenumerator

Rac_sequence does not explain

5, Nsfilehandle

Rac_readinbackground See the name of the unknown

6, Nsindexset

Rac_sequence does not explain

7, Nsinvocation

Rac_setargument:atindex: Setting parameters

Rac_argumentatindex take a parameter

Rac_returnvalue The return value of the associated method

8, Nsnotificationcenter

Rac_addobserverforname:object: Registration Notice

9, NSObject

Rac_willdeallocsignal the signal that was launched when the object was destroyed

Rac_description Debug with

Rac_observeKeyPath:options:observer:block: Listening to an event

Rac_liftselector:withsignals: All signals are next in the execution

Rac_signalforselector: Instead of a method

Rac_signalforselector: (SEL) selector Fromprotocol: Substitute proxy

10, Nsorderedset

Rac_sequence does not explain

11, Nsset

Rac_sequence does not explain

12, NSString

Rac_keypathcomponents gets all the parts of a path

Rac_keypathbydeletinglastkeypathcomponent Delete the last part of the path

Rac_keypathbydeletingfirstkeypathcomponent removing the first part of a path

Rac_sequence not explained (character)

Rac_readContentsOfURL:usedEncoding:scheduler: Multi-threaded invocation of OC

13, Nsurlconnection

Rac_sendasynchronousrequest initiating an asynchronous request

IOS Reactivecocoa most common API collation (can be used as a manual query)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.