Swiftpack.co - MatthewTHFisher/ExampleSwiftPackage as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by MatthewTHFisher.
MatthewTHFisher/ExampleSwiftPackage v1.1.0
Example swift package that embeds multiple modules/frameworks into one super package. This also demonstrates the use of DocC with the modules.
⭐️ 1
🕓 38 weeks ago
iOS macOS
.package(url: "https://github.com/MatthewTHFisher/ExampleSwiftPackage.git", from: "v1.1.0")

Example Swift Package CI/CD

The following repository is for learning and developing knowledge of swift packages and is not maintained.

The project uses a Swift package that has multiple modules, and targets each with DocC documentation. The provided package has been developed to teach how swift packages are created in a way that multiple modules can sit within a singular swift package.

This swift package currently incorportated three unique modules which are shown in the table below:

Module Description Documentation
Arithmetics Simple mathematical functions including a counter object. Link
Palindrome Contatins functionality to check whether a palindrome is valid or not.
Sequence Functions that can be performed on an array, currently only includes a simply sort function.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for learning, developing, and testing purposes.

Prerequisites

The only prerequisite is that Xcode 13.0 and above is used.

Installing

To install the required libraries into an Xcode project there are two methods.

1. Using Xcode's Swift Package Manager Go to File -> Add Packages... With the library manager open simply search for the package using the GitHub link of this page. Once the package has been fetched a list of all the optional modules that can be imported will be presented. Make sure atleast one is selected, there is no requirements for anyone of these to be added. Note: This method will allow not you to edit the package.

2. Manually downloading the package Clone the package using the clone button above. Once downloaded onto the PC simply go to File -> Add Packages... With the library manager open select the Add Local button and navigate to the downloaded package. This will add the package as a dependency to the project. THe final step is to tell the target about the framework: go to the project settings -> your target -> General -> Frameworks, Libraries, and Embedded Content -> click the plus button and add the frameworks. Note: This method will allow you to edit the downloaded package.

Useage

Once the package has been added into your project you can finally start playing around with it! As the package includes multiple modules a single import will not add all of these, instead you had to include each of them individually into your .swift files.

import Arithmetics   // Imports only the Arithmetics framework
import Palindrome    // Imports only the Palindrome framework
import Sequence      // Imports only the Sequence framework

Although the package is called "MyPackage" writing import MyPackage will produce an error. That is because within MyPackage there is no module/product with the name "MyPackage" (See the products section of Package.swift). This is the same as the title of the repository "ExampleSwiftPackage", this will appear when importing the package but has no relation to the package and it's products.

Authors

  • Matthew Fisher MIET MEng Mechatronics and Robotics, University of Leeds.

GitHub

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

Related Packages

Release Notes

ExampleSwiftPackage 1.1.0
38 weeks ago

The ExampleSwiftPackage has now been updated to include DocC documentation.

Arithmetics:

  • Added a new Counter object to help you keep count.
  • Added DocC for Arithmetics.

Palindrome:

  • Added DocC for Palindrome.

Sequence:

  • Added DocC for Sequence.

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