You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.5 KiB
64 lines
1.5 KiB
//
|
|
// DisplayContext.swift
|
|
// PadelClub
|
|
//
|
|
// Created by Razmig Sarkissian on 20/03/2024.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
enum DisplayContext {
|
|
case addition
|
|
case edition
|
|
case lockedForEditing
|
|
case selection
|
|
}
|
|
|
|
enum DisplayStyle {
|
|
case title
|
|
case wide
|
|
case short
|
|
}
|
|
|
|
enum SummoningDisplayContext {
|
|
case footer
|
|
case menu
|
|
}
|
|
|
|
struct DeviceHelper {
|
|
static func isBigScreen() -> Bool {
|
|
switch UIDevice.current.userInterfaceIdiom {
|
|
case .pad: // iPads
|
|
return true
|
|
case .phone: // iPhones (you can add more cases here for large vs small phones)
|
|
if UIScreen.main.bounds.size.width > 375 { // iPhone X, 11, 12, 13 Pro Max etc.
|
|
return true // large phones
|
|
} else {
|
|
return false // smaller phones
|
|
}
|
|
default:
|
|
return false // Other devices (Apple Watch, TV, etc.)
|
|
}
|
|
|
|
}
|
|
|
|
static func maxCharacter() -> Int {
|
|
switch UIDevice.current.userInterfaceIdiom {
|
|
case .pad: // iPads
|
|
return 30
|
|
case .phone: // iPhones (you can add more cases here for large vs small phones)
|
|
if UIScreen.main.bounds.size.width > 375 { // iPhone X, 11, 12, 13 Pro Max etc.
|
|
return 15 // large phones
|
|
} else {
|
|
return 9 // smaller phones
|
|
}
|
|
default:
|
|
return 9 // Other devices (Apple Watch, TV, etc.)
|
|
}
|
|
}
|
|
|
|
static func charLength() -> Int {
|
|
isBigScreen() ? 0 : 15
|
|
}
|
|
}
|
|
|