Skip to content

Instantly share code, notes, and snippets.

View kyungpyoda's full-sized avatar
🙃
Howdy

kyungpyoda

🙃
Howdy
View GitHub Profile
@kyungpyoda
kyungpyoda / YoutubeImageView.swift
Last active December 24, 2021 00:17
[iOS] Youtube Community ImageView clone
//
// YoutubeImageView.swift
//
// Created by 홍경표 on 2021/07/19.
//
import UIKit
class YoutubeImageView: UIImageView {
@kyungpyoda
kyungpyoda / FoldableView.swift
Created July 14, 2021 07:05
[iOS] Foldable View
//
// FoldableView.swift
//
// Created by 홍경표 on 2021/07/14.
//
import UIKit
final class FoldableView: UIView {
@kyungpyoda
kyungpyoda / CouponCodeTextField.swift
Last active June 11, 2021 05:03
[Swift] iOS awesome Coupon Code TextField
//
// CouponCodeTextField.swift
//
// Created by 홍경표 on 2021/06/10.
//
import UIKit
// Not necessary. Replacable with other ways.
import SnapKit // convenient to handle constraint
@kyungpyoda
kyungpyoda / UIImage+withBackground.swift
Last active June 3, 2021 06:50
[Swift] iOS Change background color of UIImage
//
// UIImage+withBackground.swift
//
// Created by 홍경표 on 2021/04/12.
//
import UIKit
extension UIImage {
func withBackground(color: UIColor, opaque: Bool = true) -> UIImage {
@kyungpyoda
kyungpyoda / measure.swift
Last active June 3, 2021 01:06
[Swift] Measuring execution time by using Date object
//
// measure.swift
//
// Created by 홍경표 on 2021/05/31.
//
import Foundation
final class Util {
class func measure(_ description: String = "", _ function: () -> ()) {
@kyungpyoda
kyungpyoda / UIViewController+presentToTop.swift
Last active June 2, 2021 00:55
[Swift] iOS ViewController present to top most
//
// UIViewController+presentToTop.swift
//
// Created by 홍경표 on 2021/06/01.
//
import UIKit
extension UIViewController {
func presentToTop() {
@kyungpyoda
kyungpyoda / UIViewController+back.swift
Last active June 1, 2021 09:23
[Swift] view controller going back extension
//
// UIViewController+back.swift
//
// Created by 홍경표 on 2021/06/01.
//
// TODO: `addTarget` to a button
// backButton.addTarget(nil, action: #selector(back), for: .touchUpInside)
extension UIViewController {
@kyungpyoda
kyungpyoda / Dynamic.swift
Created June 1, 2021 00:36
[Swift] Dynamic class for binding
//
// Dynamic.swift
//
// Created by 홍경표 on 2021/05/23.
//
import Foundation
final class Dynamic<T> {
@kyungpyoda
kyungpyoda / NSTextAttachment+setImageHeight.swift
Created May 31, 2021 08:04
[Swift] iOS adjust image attachment height of AttributedString
//
// NSTextAttachment+setImageHeight.swift
//
// Created by 홍경표 on 2021/05/31.
//
import UIKit.NSTextAttachment
extension NSTextAttachment {
func setImageHeight(to height: CGFloat) {
@kyungpyoda
kyungpyoda / NSAttributedString+withPrefixImage.swift
Last active June 2, 2021 07:45
[Swift] iOS Implement Prefix Image String by using NSAttributedString
//
// NSAttributedString+withPrefixImage.swift
//
// Created by 홍경표 on 2021/05/31.
//
import UIKit.UIImage
extension NSAttributedString {