iOS Development Reactivecocoa Learning notes (ii)

Source: Internet
Author: User

Macros that are common in RAC:use a macro to define a separate import #import <RACEXTScope.h> One.
    RAC (TARGET, [KeyPath, [Nil_value]]): Used to bind a property of an object     as soon as text box text changes, the text    of the label is modified = _textfield.rac_ textsignal;

Two.

    Racobserve (self, name): Listens for a property of an object and returns a signal.    [Racobserve (Self.view, center) Subscribenext:^ (ID  x) {        NSLog (@ "%@  ", x);    }];    When the Racobserve is placed inside the block must add weakify, regardless of the use of self, otherwise memory leaks, because Racobserve macro inside there is a self    @weakify;     *signal3 = [Anothersignal flattenmap:^ (Nsarraycontroller *arraycontroller) {     avoids a retain cycle because of R Acobserve implicitly referencing self        @strongify (self);         return Racobserve (Arraycontroller, items);    }];

Three.

    @weakify (obj) and @strongify (obj), generally two are in use, in the main header file (REACTIVECOCOA.H) is not imported, you need to manually import, RACEXTScope.h can use. But every time the import is very troublesome, just need to import the main header file yourself.

Four.

    ractuplepack: Wrapping data into ractuple (tuple Class) wraps the     data in the parameter into    tuples *tuple = ractuplepack @20 );

Five.

    ractupleunpack: Unpack the Ractuple (tuple Class) into corresponding data     //  wrap the data in the parameter into a tuple    ractuple *tuple = Ractuplepack (@ "xmg", @);         // Unpacking the tuple, the value of the tuple, in order to assign values    to the variables inside the parameter // name = @ "XMG" age = @20    Ractupleunpack (nsstring *name,nsnumber *age) = tuple;

iOS Development Reactivecocoa Learning notes (ii)

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.