Contents

itztravelintime/swiftpackagesbase

A Swift Library containing useful code for Any Swift project.

Features

  • 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")

What apps/programs is this Library intended for?

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.

About the project:

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.

Credits:

  • ITzTravelInTime (Pietro Caruso) - Project creator and main developer.

Contacts

  • ITzTravelInTime (Pietro Caruso, project creator): piecaruso97@gmail.com

Package Metadata

Repository: itztravelintime/swiftpackagesbase

Default branch: main

README: README.md