ABDefaultRepository

@objc(FWABDefaultRepository)
@objcMembers
public class ABDefaultRepository : NSObject, ABRandomRepository

默认随机数仓库,存储于UserDefaults

Accessor

  • 单例模式

    Declaration

    Swift

    public static let sharedInstance: ABDefaultRepository

Lifecycle

  • 初始化,使用默认UserDefaults

    Declaration

    Swift

    public override init()
  • 初始化,指定UserDefaults

    Declaration

    Swift

    public init(userDefaults: UserDefaults)

Public

  • 获取指定key随机数

    Declaration

    Swift

    public func getRandomNumber(key: String) -> Int
  • 设置指定key随机数

    Declaration

    Swift

    public func setRandomNumber(_ randomNumber: Int, key: String)
  • 删除指定key随机数

    Declaration

    Swift

    public func removeRandomNumber(key: String)