Skip to content

Instantly share code, notes, and snippets.

View cotkjaer's full-sized avatar

Christian cotkjaer

View GitHub Profile
@cotkjaer
cotkjaer / CGRect+Center.swift
Last active November 23, 2023 06:15
Swift extensions to add "center" to CGRect
extension CGRect
{
/** Creates a rectangle with the given center and dimensions
- parameter center: The center of the new rectangle
- parameter size: The dimensions of the new rectangle
*/
init(center: CGPoint, size: CGSize)
{
self.init(x: center.x - size.width / 2, y: center.y - size.height / 2, width: size.width, height: size.height)
@cotkjaer
cotkjaer / init_for_custom_uiview
Created June 4, 2014 06:41
Init for Custom UIView
#pragma mark - Init
- (void)setup
{
<#view_setup_code#>
}
- (instancetype)initWithCoder:(NSCoder *)decoder
{
self = [super initWithCoder:decoder];