Skip to content

Instantly share code, notes, and snippets.

View ucwealth's full-sized avatar

Uche Okeke ucwealth

View GitHub Profile
@IniongunIsaac
IniongunIsaac / RectangularDashedView.swift
Created June 23, 2021 10:52
View with dashed borders
import UIKit
class RectangularDashedView: UIView {
@IBInspectable var viewCornerRadius: CGFloat = 0 {
didSet {
layer.cornerRadius = viewCornerRadius
layer.masksToBounds = viewCornerRadius > 0
}
}
@V8tr
V8tr / AutoLayoutDSL.swift
Last active October 31, 2023 17:42
Auto Layout DSL
import UIKit
/// Represents a single `NSLayoutConstraint`
enum LayoutAnchor {
case constant(attribute: NSLayoutConstraint.Attribute,
relation: NSLayoutConstraint.Relation,
constant: CGFloat)
case relative(attribute: NSLayoutConstraint.Attribute,
relation: NSLayoutConstraint.Relation,
@sonnguyen0310
sonnguyen0310 / gist:6720cbf39ce877c20fea1a987543fb99
Created July 2, 2018 08:31
iOS 11: Change size of UIBarButtonItem (image) in Swift 3
func setUpMenuButton(){
let menuBtn = UIButton(type: .custom)
menuBtn.frame = CGRect(x: 0.0, y: 0.0, width: 20, height: 20)
menuBtn.setImage(UIImage(named:"menuIcon"), for: .normal)
menuBtn.addTarget(self, action: #selector(vc.onMenuButtonPressed(_:)), for: UIControlEvents.touchUpInside)
let menuBarItem = UIBarButtonItem(customView: menuBtn)
let currWidth = menuBarItem.customView?.widthAnchor.constraint(equalToConstant: 24)
currWidth?.isActive = true
let currHeight = menuBarItem.customView?.heightAnchor.constraint(equalToConstant: 24)
@uupaa
uupaa / image.resize.in.github.flavored.markdown.md
Last active July 11, 2024 16:08
image resize in github flavored markdown.

Image source

https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png

Try resize it!

  • ![](https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png | width=100)