You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-ios/SessionUIKit/Types/Position.swift

23 lines
538 B
Swift

// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
import Foundation
import GRDB
public enum Position: Int, Decodable, Equatable, Hashable, DatabaseValueConvertible {
case top
case middle
case bottom
case individual
public static func with(_ index: Int, count: Int) -> Position {
guard count > 1 else { return .individual }
switch index {
case 0: return .top
case (count - 1): return .bottom
default: return .middle
}
}
}