SwiftPackagesBase

包含适用于任何 Swift 项目的实用代码的 Swift 库。

功能

以下是一些功能示例

SimulatableDetectable:

import SwiftPackagesBase

class Foo: SimulatableDetectable{

    ///if this property is nil the `actualStatus` property will be returned by the `status` propert, otherwise that will return the value of this property
    static var simulatedStatus: Bool? = nil
    
    ///Returns the actual status
    static func calculateStatus() -> Bool{
        return false
    }
    
    ///Initializer for compliance with the protocol
    public required init(){  }
    
}

print("Testing Foo status: ")

print("Foo status: \(Foo.status)") //returns false
print("Foo actual status: \(Foo.actualStatus)") //returns false

print("Simulating a new status")
Foo.simulatedStatus = true

print("Foo status: \(Foo.status)") //returns true
print("Foo actual status: \(Foo.actualStatus)") //returns false

print("Foo testing is complete")

此库旨在用于哪些应用/程序?

此库应供需要此处提供的代码的 Swift 应用/程序或库使用。

此代码应可在与 Swift 兼容并在使用 Foundation 模块时提供必要函数调用的多个平台上运行。

关于项目

此代码是作为我的 TINU 项目 的一部分创建的,并且已被分离并制成独立的库,以使主项目的源代码不那么复杂,并且更专注于其目标。

此外,将其作为独立的库可以单独更新代码,因此主 TINU 应用的各个版本都能够使用此库的最新版本进行编译。

鸣谢

联系方式

法律信息

包含适用于任何 Swift 项目的实用工具代码的 Swift 库。版权 (C) 2022 Pietro Caruso

此库是自由软件;您可以根据自由软件基金会发布的 GNU 宽通用公共许可证的条款重新发布和/或修改它;许可证的 2.1 版本或(由您选择)任何更高版本。

发布此库是希望它会很有用,但不提供任何担保;甚至不提供关于适销性或适用于特定用途的默示担保。有关更多详细信息,请参阅 GNU 宽通用公共许可证。

您应该已收到随此库一起提供的 GNU 宽通用公共许可证副本;如果没有,请写信给 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA。