GSSynthesizeSingleton 4.0.0

GSSynthesizeSingleton 4.0.0

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最新版本2017年1月

GyazSquareGoichi Hirakawa维护。



  • GyazSquare

GSSynthesizeSingleton是一个简单的宏,用于生成Objective-C单例类的成员函数。

需求

  • Xcode 8.1或更高版本
  • 基础SDK:iOS 10.1 / OS X 10.12 / watchOS 3.1 / tvOS 10.0或更高版本

安装

源代码

检出源代码

$ git clone https://github.com/GyazSquare/GSSynthesizeSingleton.git

将GSSynthesizeSingleton.h复制到您的项目中。

用法

  1. 在头文件中声明一个单例类方法。
  2. 在源文件中添加一个宏。

MyManager.h

@import Foundation;

@interface MyManager : NSObject

+ (instancetype)sharedManager;

@end

MyManager.m

#import "GSManager.h"
#import "GSSynthesizeSingleton.h"

@implementation MyManager

GSSynthesizeSingleton(My, Manager);

@end

许可证

GSSynthesizeSingleton遵循MIT许可证。

有关更多信息,请参阅LICENSE文件。