Skip to content

Latest commit

 

History

History
87 lines (50 loc) · 2.61 KB

README.md

File metadata and controls

87 lines (50 loc) · 2.61 KB

MultiUser handling for swift

MultiUser is created and maintaned with ❥ by Sascha Muellner.


Travis CI Maintainability Test Coverage Platforms Version License Swift Version SPM compatible Reviewed by Hound README

Requirements

The latest version of MultiUser requires:

  • Swift 5+
  • iOS 13+
  • Xcode 11+

Installation

Swift Package Manager

Using SPM add the following to your dependencies

'MultiUser', 'master', 'https://github.com/smuellner/MultiUser-for-swift.git'

CocoaPods

Using CocoaPods add the following to your Podfile:

pod 'MultiUser-for-Swift', '~> 1.0.1'

What?

This is a Swift package with support for iOS/macOS/tvOS/watchOS that allows to store user releated data for multiple users of an application.

How to use?

Service

The UserService cares for the whole user handling and implements the UserServiceProtocol. To allow for access throughout your application place the UserService in a shared instance like the Application Delegate or use a dependency injection framework like Swinject.

// AppDelegate.swift

let userService = UserService()



User

Retrieve a list of all users:

let userService = UserService()

print(userService.allUsers)
//

Create a user

let user = userService.createUser()
user.username = ""
user.firstname = ""
user.lastname = ""

userService.saveUser(user)