Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/itztravelintime/swiftpackagesbase

A Swift Library containing useful code for Any Swift project.
https://github.com/itztravelintime/swiftpackagesbase

cross-platform ios ipados linux macos swift swift-package-manager tvos utility-library watchos

Last synced: 13 days ago
JSON representation

A Swift Library containing useful code for Any Swift project.

Awesome Lists containing this project

README

        

# 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:

```swift

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](https://github.com/ITzTravelInTime/TINU) 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): [email protected]

## Legal info

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