-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathProfilePersister.swift
46 lines (32 loc) · 1.06 KB
/
ProfilePersister.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// ProfilePersister.swift
// C-Tracker-SCCS
//
// Created by Pascal Pfiffner on 10.02.17.
// Copyright © 2017 SCCS. All rights reserved.
//
/**
Types adopting this protocol are used to persist profile data on the device.
*/
public protocol ProfilePersister {
// MARK: - User
/** Load the enrolled user's data, if any. */
func loadEnrolledUser(type: User.Type) throws -> User?
/** Persist user properties. */
func persist(user: User) throws
/** Handle user withdrawal. */
func userDidWithdraw(user: User?) throws
// MARK: - Tasks
/** Load all tasks for the user. */
func loadAllTasks(for user: User?) throws -> [UserTask]
/**
Persist information about a specific task. It can be assumed that all other tasks should be left untouched.
- parameter task: The task that has updated information
*/
func persist(task: UserTask) throws
/**
Persist a user task schedule. It can be assumed that the array contains **all** of the user's tasks.
- parameter schedule: An array of all the user's tasks
*/
func persist(schedule: [UserTask]) throws
}