Swiftpack.co - ITzTravelInTime/SwiftPackagesBase as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ITzTravelInTime.
ITzTravelInTime/SwiftPackagesBase 0.0.14
A Swift Library containing useful code for Any Swift project.
⭐️ 0
🕓 3 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/ITzTravelInTime/SwiftPackagesBase.git", from: "0.0.14")

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

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

GitHub

link
Stars: 0
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Version 0.0.14
3 weeks ago
  • Added an extension for RawRepresentable types which conforms to the Identifiable protocol, so it's no longer necessary to implement the id property.
  • Fixed a build issue with Swift 5.3 and below.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics