Skip to content

A collection of tools used in our Swift projects

License

Notifications You must be signed in to change notification settings

netguru/Square1-iOS-Tools

 
 

Repository files navigation

Square1 iOS Tools

Cocoapods Platform

A handy collection of helpers, types and hacks used on our Swift projects.

Index

Prerequisites

  • iOS 9.0+
  • XCode 10+
  • Swift 4.2+

Installing

Cocoapods

If you're already using Cocoapods in your project, just skip to step 3

  1. Install Cocoapods
  2. Create a Podfile for your project
  3. Make sure you use
use_frameworks!
  1. Add this pod to your Podfile
pod 'Square1Tools'
  1. Run pod install
  2. Use this import on every file you want to use the pod
import Square1Tools

Running the tests

  1. Download the source project
  2. Hit Cmd + U to run the tests.

How to use

Check the documentation page.

Keychain

Keychain is a helper class to quickly access to stored values in iOS Keychain.

You can instance a Keychain object like this:

let keychain = Keychain()

// You can also instance it with a specific access group.
let anotherKeychain = Keychain(accessGroup: "MyGroup")

Using Keychain is straightforward :

// Save into keychain
keychain.save("Hello World!!", forKey: "MyKey") // returns true if ok, otherwise false

// Read from keychain
keychain.get("MyKey") // returns String?

// Delete from keychain
keychain.delete("MyKey") // returns true if ok, otherwise false

Log

Log is a helper method for more accurate console prints. From iOS 10 we use OSLog class to print logs. You can use the Mac's Console app to filter and manage logs by subsystem and category. We add more util info in debug mode like line, function and emojis.

More info Unified logging.

Usage

Log("Default message with default OSLog")
let testLog = OSLog(subsystem: "S1.Square1ToolsApp.test", category: "test")
Log("Info message", log: testLog, type: .info)

Console app output(filter for subsystem) Console Logs

Console Xcode output Xcode Logs

Contributing

Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us. Make sure you comment modified and new code and use Jazzy to generate new documentation before making a pull request.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

To all the great Swift community out there.

About

A collection of tools used in our Swift projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.3%
  • Other 0.7%