Print object properties When using description to print objects in the "Swift" iOS development

Source: Internet
Author: User
Tags print object

When we print objects in iOS development, we directly output the object address, which is not convenient for us to develop. When we can use description to print objects, the properties of the output object

You can rewrite it directly in OC. The printable protocol is required in Swift

Look at the following example

1     Overridevar description:string {2Let properties = ["Property 1","Property 2","Property 3","Property 4"]3         4         return "\ (Dictionarywithvaluesforkeys (properties))"5}

Print object properties When using description to print objects in the "Swift" iOS development

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.