-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstants.swift
More file actions
68 lines (61 loc) · 3.12 KB
/
Constants.swift
File metadata and controls
68 lines (61 loc) · 3.12 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// Constants.swift
// RecipeTimer
//
// Created by Sam McGarry on 4/15/20.
// Copyright © 2020 Sam McGarry. All rights reserved.
//
import Foundation
import UIKit
//Images used for testing purposes
struct images {
static let chickensoup = UIImage(named: "chickensoup")!
static let lasagna = UIImage(named: "lasagna")!
static let salmon = UIImage(named: "salmon")!
static let spaghetti = UIImage(named: "spaghetti")!
static let add = UIImage(named: "add")!
static let emptyState = UIImage(named: "EmptyState")!
static let selectImage = UIImage(named: "SelectImage")!
}
//Reusable cell identifiers
struct Cells {
static let recipeCell = "RecipeCell"
static let ingredientCell = "IngredientCell"
static let prepStepCell = "PrepStepCell"
static let cookingStepCell = "CookingStepCell"
static let titleCell = "TitleCell"
static let imageCell = "ImageCell"
static let buttonCell = "ButtonCell"
}
struct ErrorMessages {
static let noContent = "Looks like your recipe doesn't have any content. In order to use the Walkthrough feature your recipe needs atleast one Ingredient, Prep Step, or Cooking Step. You can add these by pressing the edit button."
static let noRecipes = "No recipes?\nAdd one by tapping the plus button."
}
//Represents the width and height of the current device screen
enum ScreenSize {
static let width = UIScreen.main.bounds.size.width
static let height = UIScreen.main.bounds.size.height
static let maxLength = max(ScreenSize.width, ScreenSize.height)
static let minLength = min(ScreenSize.width, ScreenSize.height)
}
//Depicts whether or not a device is of a certain type
enum DeviceType {
static let idiom = UIDevice.current.userInterfaceIdiom
static let nativeScale = UIScreen.main.nativeScale
static let scale = UIScreen.main.scale
static let isiPhoneSE = idiom == .phone && ScreenSize.maxLength == 568.0
static let isiPhone8Standard = idiom == .phone && ScreenSize.maxLength == 667.0 && nativeScale == scale
static let isiPhone8Zoomed = idiom == .phone && ScreenSize.maxLength == 667.0 && nativeScale > scale
static let isiPhone8PlusStandard = idiom == .phone && ScreenSize.maxLength == 736.0
static let isiPhone8PlusZoomed = idiom == .phone && ScreenSize.maxLength == 736.0 && nativeScale < scale
static let isiPhoneX = idiom == .phone && ScreenSize.maxLength == 812.0
static let isiPhoneXsMaxAndXr = idiom == .phone && ScreenSize.maxLength == 896.0
static let isiPad = idiom == .pad && ScreenSize.maxLength == 1024.0
static let isiPad7thGen = idiom == .pad && ScreenSize.maxLength == 1080.0
static let isiPad11inch = idiom == .pad && ScreenSize.maxLength == 1194.0
static let isiPadPro = idiom == .pad && ScreenSize.maxLength == 1366.0
static let isiPadAir = idiom == .pad && ScreenSize.maxLength == 1112.0
static func isiPhoneXAspectRation() -> Bool {
return isiPhoneX || isiPhoneXsMaxAndXr
}
}