Skip to content

Instantly share code, notes, and snippets.

View cscouto's full-sized avatar
🎯
Focusing

Tiago Henrique Do Couto cscouto

🎯
Focusing
  • Couto Code
  • Charlotte, NC
View GitHub Profile
@cscouto
cscouto / ProgressStatusView
Last active March 13, 2019 19:53
SWIFT - Custom progress bar
//
// ProgressView.swift
// CustomProgress
//
// Created by COUTO, TIAGO on 3/12/19.
// Copyright © 2019 Couto Code. All rights reserved.
//
import UIKit
@cscouto
cscouto / UILabel+Height.swift
Created August 20, 2018 18:29
SWIFT - UILabel content size for specific width
//
// UILabel+height.swift
// AllBody
//
// Created by Tiago Do Couto on 8/20/18.
// Copyright © 2018 coutocode. All rights reserved.
//
import UIKit
@cscouto
cscouto / String+AES.swift
Created July 31, 2018 23:02
SWIFT - Encrypt/Decrypt AES with CryptoSwift
//
// String+AES.swift
// bitcoin
//
// Created by Tiago Do Couto on 7/31/18.
// Copyright © 2018 coutocode. All rights reserved.
//
import CryptoSwift
@cscouto
cscouto / UIDevice+Model.swift
Created July 31, 2018 22:04
SWIFT - Device model name
extension UIDevice {
var modelName: String {
var systemInfo = utsname()
uname(&systemInfo)
let machineMirror = Mirror(reflecting: systemInfo.machine)
let identifier = machineMirror.children.reduce("") { identifier, element in
guard let value = element.value as? Int8 , value != 0 else { return identifier }
return identifier + String(UnicodeScalar(UInt8(value)))
}
@cscouto
cscouto / UIView+Shadow.swift
Created July 24, 2018 21:36
SWIFT - Add Shadows to UIView
//
// UIView+Shadows.swift
// brasileirao
//
// Created by Tiago Do Couto on 7/24/18.
// Copyright © 2018 coutocode. All rights reserved.
//
import UIKit
@cscouto
cscouto / Image+Gif.Swift
Created May 9, 2018 23:35
SWIFT - Image gift loader
import UIKit
import ImageIO
fileprivate func < <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
switch (lhs, rhs) {
case let (l?, r?):
return l < r
case (nil, _?):
return true
@cscouto
cscouto / RecyclerViewTouchListener.kt
Created April 17, 2018 19:26
KOTLIN - Class to implement RecyclerView Click and Longclick
/*
* Copyright (c) 2018. Couto Code
*/
package com.coutocode.allgifts.Utils
/**
* Created by docouto on 4/17/18.
*/
@cscouto
cscouto / SquareLayout.kt
Created April 9, 2018 23:26
KOTLIN - Class to make a squared size item for you recyclerview grid layout
import android.annotation.TargetApi
import android.content.Context
import android.os.Build
import android.util.AttributeSet
import android.widget.RelativeLayout
/**
* Created by docouto on 4/9/18.
*/
@cscouto
cscouto / CsvMapper.swift
Created March 25, 2018 17:15
SWIFT - CSV Mappper
//
// CsvMapper.swift
//
// Created by Tiago Do Couto on 3/25/18.
// Copyright © 2018 CoutoCode. All rights reserved.
//
import Foundation
open class CsvMapper {
@cscouto
cscouto / MessageVC.Swift
Created March 16, 2018 19:36
SWIFT - Moving UITextField with the keyboard
import UIKit
class MessageVC: UIViewController {
@IBOutlet weak var textViewMessage: UITextView!
@IBOutlet weak var heightMessage: NSLayoutConstraint!
@IBOutlet var viewMessage: UIView! // the view that will be attached to the keyboard
var messageVM: MessageViewModel!
let MESSAGE_INITIAL_SIZE: CGFloat = 44