Skip to content

Instantly share code, notes, and snippets.

View Athosone's full-sized avatar

WERCK Ayrton Athosone

  • Lyon, France
View GitHub Profile
func associatedObject<T: AnyObject>(
base: AnyObject,
key: UnsafePointer<UInt8>,
initialiser: () -> T)
-> T {
if let associated = objc_getAssociatedObject(base, key)
as? T { return associated }
let associated = initialiser()
objc_setAssociatedObject(base, key, associated,
.OBJC_ASSOCIATION_RETAIN)
+ (CGRect) screenFrame
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
return screenRect;
}
+ (UIImage *)convertViewToImage
{
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
@Athosone
Athosone / CustomModalAnimation.m
Last active January 3, 2016 17:37
Animation->Popup with a bump effect
//
// CustomModalAnimation.m
// Wineot
//
// Created by Werck Ayrton on 18/02/2015.
// Copyright (c) 2015 wineot. All rights reserved.
//
#import "CustomModalAnimation.h"
//
// CustomModalAnimation.h
// Wineot
//
// Created by Werck Ayrton on 18/02/2015.
// Copyright (c) 2015 wineot. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
//
// Animations.h
// thirsty
//
// Created by Werck Ayrton on 02/06/2015.
// Copyright (c) 2015 Nyu Web Developpement. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <POP/POP.h>
extension UIView {
@IBInspectable var cornerRadius: CGFloat {
get {
return layer.cornerRadius
}
set {
layer.cornerRadius = newValue
layer.masksToBounds = newValue > 0
}
import Foundation
import UIKit
extension UITextField {
func designTextField(placeholder: String,content: String?){
let paddingView = UIView(frame: CGRectMake(0, 0, 15, self.frame.height))
self.enabled = true
//Added animation
import UIKit
extension CALayer
{
func moveToFront()
{
if let superLayerUnwrp = self.superlayer
{
self.removeFromSuperlayer()
protocol EA_SessionViewsProtocol
{
static func instanceFromNib<T:EA_SessionViewsProtocol>() -> T
func displayDatasInView(datas:AnyObject?)
}
class EA_SessionViewsFactory {
static func CreateView<T:EA_SessionViewsProtocol>() -> T
{
extension UIColor
{
static func colorFromHexaString(hexa:String) -> UIColor
{
var cString:String = hexa.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).uppercaseString
if (cString.hasPrefix("#"))
{
cString = (cString as NSString).substringFromIndex(1)
}