forked from shadowfacts/Tusker
29 lines
534 B
Swift
29 lines
534 B
Swift
//
|
|
// AvatarStyle.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 8/28/18.
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
enum AvatarStyle: String, Codable {
|
|
case roundRect, circle
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|