Tusker/Tusker/Preferences/AvatarStyle.swift

29 lines
534 B
Swift
Raw Normal View History

2018-08-28 23:16:17 +00:00
//
// AvatarStyle.swift
// Tusker
//
// Created by Shadowfacts on 8/28/18.
// Copyright © 2018 Shadowfacts. All rights reserved.
//
2018-08-28 23:49:31 +00:00
import UIKit
2018-08-28 23:16:17 +00:00
enum AvatarStyle: String, Codable {
case roundRect, circle
}
2018-08-28 23:49:31 +00:00
extension AvatarStyle {
var cornerRadiusFraction: CGFloat {
switch self {
case .roundRect:
return 0.1
case .circle:
return 0.5
}
}
func cornerRadius(for view: UIView) -> CGFloat {
return cornerRadiusFraction * view.frame.width
}
}