# CutBox.app

## Coverage Report

#### Created: 2024-03-12 03:40

    .../Source/Extensions/KeyCombo+Archive.swift

    Line

    Count

    Source (jump to first uncovered line)

    1

    //

    2

    //  KeyCombo+Archive.swift

    3

    //  CutBox

    4

    //

    5

    //  Created by Jason Milkins on 2/4/18.

    6

    //  Copyright © 2018-2023 ocodo. All rights reserved.

    7

    //

    8

    9

    import Magnet

    10

    11

    extension KeyCombo {

    12

    13

    1

        func saveUserDefaults(identifier: String, defaults: UserDefaults = .standard) {

    14

    1

            let data = NSKeyedArchiver

    15

    1

                .archivedData(withRootObject: self)

    16

    1

            defaults.set(data, forKey: identifier)

    17

    1

        }

    18

    19

    5

        static func loadUserDefaults(identifier: String, defaults: UserDefaults = .standard) -> KeyCombo? {

    20

    5

            guard let data = defaults.data(forKey: identifier) else { return nil }

    21

    2

    22

    2

            if let keyCombo = NSKeyedUnarchiver

    23

    2

                .unarchiveObject(with: data) as? KeyCombo? {

    24

    1

                return keyCombo

    25

    1

            } else {

    26

    1

                return nil

    27

    1

            }

    28

    0

        }

    29

    }