A Swift Library containing useful code for Any Swift project.
- Many useful extensins for
String
,Array
and more! - The
SimulatableDetectable
family of protocols which allows for automated types of value fetching. - The
FetchingProtocol
family of protcols which allows for a stanadard interface for value fetching. - Extensions to the basic data types for easy type conversions.
Here are some examples for some features:
SimulatableDetectable:
-
A set of protocols for objects that needs to have simulated debug states.
Example usage:
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")
This library should be used by Swift apps/programs or libraries that needs the code provvided here.
This code should work across multiple platforms compatible with Swift and that provvides the necessary function calls using the Foundation module.
This code was created as part of my TINU project and it has been separated and made into it's own library to make the main project's source less complex and more focused on it's aim.
Also having this as it's own library allows for code to be updated separately and so various versions of the main TINU app will be able to be compiled all with the latest version of this library.
- ITzTravelInTime (Pietro Caruso) - Project creator and main developer.
- ITzTravelInTime (Pietro Caruso, project creator): piecaruso97@gmail.com
A Swift Library containing useful utilities code for Any Swift project. Copyright (C) 2022 Pietro Caruso
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA