One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
let state = [ "AK - Alaska", | |
"AL - Alabama", | |
"AR - Arkansas", | |
"AS - American Samoa", | |
"AZ - Arizona", | |
"CA - California", | |
"CO - Colorado", | |
"CT - Connecticut", | |
"DC - District of Columbia", | |
"DE - Delaware", |
let countries = [ | |
"AF - Afghanistan", | |
"AX - Aland Islands", | |
"AL - Albania", | |
"DZ - Algeria", | |
"AS - American Samoa", | |
"AD - Andorra", | |
"AO - Angola", | |
"AI - Anguilla", | |
"AQ - Antarctica", |
class ArrayImpl<T> { | |
var space: Int | |
var count: Int | |
var ptr: UnsafeMutablePointer<T> | |
init(count: Int = 0, ptr: UnsafeMutablePointer<T> = nil) { | |
self.count = count | |
self.space = count | |
if !UIAccessibilityIsReduceTransparencyEnabled() { | |
view.backgroundColor = .clear | |
let blurEffect = UIBlurEffect(style: .dark) | |
let blurEffectView = UIVisualEffectView(effect: blurEffect) | |
//always fill the view | |
blurEffectView.frame = self.view.bounds | |
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight] | |
view.addSubview(blurEffectView) //if you have more UIViews, use an insertSubview API to place it where needed |
protocol Dimension { | |
func constraint(equalToConstant c: CGFloat) -> NSLayoutConstraint | |
} | |
protocol Anchor { | |
func constraint(equalTo anchor: Self, constant: CGFloat) -> NSLayoutConstraint | |
func constraint(greaterThanOrEqualTo anchor: Self, constant: CGFloat) -> NSLayoutConstraint | |
func constraint(lessThanOrEqualTo anchor: Self, constant: CGFloat) -> NSLayoutConstraint | |
} |
/// A little pieve of genius by me that culculates cell size base on the image given while maintaining aspect ratio | |
open class MediaMessageSizeCalculator { | |
open func messageContainerSize(for image: UIImage) -> CGSize { | |
let maxWidth = UIScreen.main.bounds.width - 16 | |
let sizeForMediaItem = { (maxWidth: CGFloat, item: UIImage) -> CGSize in | |
if maxWidth < item.size.width { | |
// Maintain the ratio if width is too great | |
let height = maxWidth * item.size.height / item.size.width | |
return CGSize(width: maxWidth, height: height) | |
} |
extension UIView { | |
func height(constant: CGFloat) { | |
setConstraint(value: constant, attribute: .height) | |
} | |
func width(constant: CGFloat) { | |
setConstraint(value: constant, attribute: .width) | |
} | |
private func removeConstraint(attribute: NSLayoutConstraint.Attribute) { |
var millisecondsSince1970: Int { | |
return Int(self.timeIntervalSince1970.rounded()) | |
} | |
init(milliseconds: Int) { | |
self = Date(timeIntervalSince1970: TimeInterval(milliseconds / 1000)) | |
} |