Skip to content

Instantly share code, notes, and snippets.

View tahseen0amin's full-sized avatar

Tasin Zarkoob tahseen0amin

View GitHub Profile
@tahseen0amin
tahseen0amin / PaddingLabel.swift
Created February 4, 2020 10:00
UILabel with padding
import UIKit
@IBDesignable class PaddingLabel: UILabel {
@IBInspectable var topInset: CGFloat = 5.0
@IBInspectable var bottomInset: CGFloat = 5.0
@IBInspectable var leftInset: CGFloat = 16.0
@IBInspectable var rightInset: CGFloat = 16.0
override func drawText(in rect: CGRect) {
import QuartzCore
class CircleImageView : UIView {
var image: UIImage! {
didSet {
self.addLayers()
}
}
override var frame: CGRect {
@tahseen0amin
tahseen0amin / APIManager.swift
Created February 25, 2018 19:27
Complete API Manager
import Foundation
protocol ApiRequest {
var urlRequest: URLRequest { get }
}
protocol ApiClient {
func execute<T>(request: ApiRequest, completionHandler: @escaping (_ result: Result<ApiResponse<T>>) -> Void)
}
import Foundation
/**
Extension on `Dictionary` that adds different helper methods such as JSON `Data` serialization
*/
public extension Dictionary where Key: ExpressibleByStringLiteral, Value: Any {
/**
Heper method that serializes the `Dictionary` to JSON `Data`
@tahseen0amin
tahseen0amin / FullWidthCenteredImageView
Last active June 22, 2017 09:22
FullWidthCenteredImageView for full width
class FullWidthCenteredImageView: UIView {
var image: UIImage!{
didSet {
self.frame = CGRect(origin: self.frame.origin, size: self.frame.size)
}
}
override var frame: CGRect {
didSet {
@tahseen0amin
tahseen0amin / CircleImageView
Created June 15, 2017 04:55
UIView with circular shape and shadow
import QuartzCore
class CircleImageView : UIView {
var image: UIImage! {
didSet {
self.addLayers()
}
}
override var frame: CGRect {