Swift's pure code creates a cell

Source: Internet
Author: User

Beginner Swift But there's only a lot of Swift's cell created with Xib, and that's not what I want. Today, I got a code that doesn't have to be written xib pure code.

Custom cell

Here's the controller.

Exception to say a little lazy loading

Lazy Loading of OC

@property (nonatomic, Strong) Nsmutablearray * DATASOURCE;

-(Nsmutablearray *) DataSource {

if (!_datasource) {

_datasource = [Nsmutablearray array];

}

return _datasource;

}

Swift, that's what I wrote.

Lazy Loading

Lazy var players:[string] = {

var temporaryplayers = [String] ()

Temporaryplayers.append ("test2")//assignment operation

Temporaryplayers.append ("Just won't sleep at the World Cup to see a deep understanding of Cuona is considered a skill tested")//assignment operation

Return temporaryplayers

}()

This blog is well written: http://www.cnblogs.com/QianChia/p/5777421.html#undefined

Swift's pure code creates a cell

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.