aboutsummaryrefslogtreecommitdiff
path: root/Captura/Data/OutputFormatSetting.swift
blob: 211a08e596c8f9017b480c6190544531907ebded (plain)
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
import Foundation

enum OutputFormatSetting: Int {
  case gifOnly = 0
  case mp4Only = 1
  case all = 2
  
  init?(_ string: String) {
    switch(string) {
    case "gif":
      self = .gifOnly
    case "mp4":
      self = .mp4Only
    case "all":
      self = .all
    default:
      return nil
    }
  }
  
  func shouldSaveGif() -> Bool {
    return self == .gifOnly || self == .all
  }
  
  func shouldSaveMp4() -> Bool {
    return self == .mp4Only || self == .all
  }
  
  func toString() -> String {
    switch(self) {
    case .gifOnly:
      return "gif"
    case .mp4Only:
      return "mp4"
    case .all:
      return "all"
    }
  }
}