Skip to content

Instantly share code, notes, and snippets.

View dhavalnenaagile's full-sized avatar
🎯
Focusing

Dhaval Nena dhavalnenaagile

🎯
Focusing
View GitHub Profile
class CustomLabel: UILabel {
let edgeInsets: UIEdgeInsets
init(frame: CGRect, insets: UIEdgeInsets) {
edgeInsets = insets
super.init(frame: frame)
}
convenience init(text: String?, dx: CGFloat, dy: CGFloat) {
class A{
class func classFunction(){
}
static func staticFunction(){
}
class func classFunctionToBeMakeFinalInImmediateSubclass(){
}
}
class B: A {
@abhimuralidharan
abhimuralidharan / QRScannerView.swift
Created March 11, 2019 06:40
QRCode scanner in iOS swift
//
// QRScannerView.swift
// QRCodeReader
//
// Created by KM, Abhilash a on 08/03/19.
// Copyright © 2019 KM, Abhilash. All rights reserved.
//
import Foundation
import UIKit
@yusuke024
yusuke024 / ViewController.swift
Created November 16, 2018 03:15
Recording video with AVAssetWriter
import UIKit
import AVFoundation
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
switch AVCaptureDevice.authorizationStatus(for: .video) {
case .notDetermined:
@nguyentruongky
nguyentruongky / Gradient_border_button.md
Last active May 31, 2023 00:00
A library to create gradient border button

How to draw a gradient border button?

My Problem

Last week, my partner showed me his design for our application. Everything is great, easily implemented with some custom controls. But wait, something is not in my knowledge.

A button with gradient border. Never try it before. Up to now, I just created gradient background views 2 times in previous projects. Googled and found some good results.

@schickling
schickling / UIImageFixedOrientationExtension.swift
Last active February 4, 2024 15:00
Extension to fix orientation of an UIImage (Sets orientation to portrait)
extension UIImage {
func fixedOrientation() -> UIImage {
if imageOrientation == UIImageOrientation.Up {
return self
}
var transform: CGAffineTransform = CGAffineTransformIdentity
@kristopherjohnson
kristopherjohnson / KeyboardNotification.swift
Last active October 6, 2023 14:45
Swift convenience wrapper for the userInfo values associated with a UIKeyboard notification
import UIKit
/// Wrapper for the NSNotification userInfo values associated with a keyboard notification.
///
/// It provides properties that retrieve userInfo dictionary values with these keys:
///
/// - UIKeyboardFrameBeginUserInfoKey
/// - UIKeyboardFrameEndUserInfoKey
/// - UIKeyboardAnimationDurationUserInfoKey
/// - UIKeyboardAnimationCurveUserInfoKey