94

书写一个严谨的单例

 6 years ago
source link: https://juejin.im/post/5a6141ebf265da3e303c8d23
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
前言 什么是单例? 一个类只有一个实例(一个对象),而且该实例易于供外界访问,从而方便地控制了实例个数,并节约系统资源 正题 在iOS开发中单例是很平常的模式,但是昨天去面试的时候被人问到了一个比较尴尬的问题。 平常在项目中我们书写的单例大概应该都是这个样子,

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK