Skip to content

Instantly share code, notes, and snippets.

import Foundation
import UIKit
class ScrollingImageCell: UICollectionViewCell {
var imageView: UIImageView!
var scrollView: UIScrollView!
var doubleTapGesture: UITapGestureRecognizer!
var image: UIImage? {
didSet{
//Move Object
public float moveSpeed;
// Use this for initialization
void Start () {
moveSpeed = 1f;
}
// Update is called once per frame
void Update () {
private let kTableHeaderHeight: CGFloat = 300
var headerView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
headerView = tableView.tableHeaderView
tableView.tableHeaderView = nil
tableView.addSubview(headerView)
let darkNavy = UIColor(red:0.07, green:0.09, blue:0.18, alpha:1.0)
let lightBlue = UIColor(red:0.22, green:0.52, blue:0.84, alpha:1.0)
let oceanGreen = UIColor(red:0.22, green:0.52, blue:0.84, alpha:1.0)
let lightningYellow = UIColor(red:0.98, green:0.71, blue:0.16, alpha:1.0)
let greyBlue =UIColor(red:0.55, green:0.56, blue:0.63, alpha:1.0)
let geenishGrey = UIColor(red:0.80, green:0.85, blue:0.75, alpha:1.0)
let lighterBlue = UIColor(red:0.53, green:0.67, blue:0.86, alpha:1.0)
let mustardYellow = UIColor(red:0.83, green:0.63, blue:0.23, alpha:1.0)
@gkye
gkye / UIImage+PixelColor.swift
Created August 20, 2016 23:42 — forked from marchinram/UIImage+PixelColor.swift
iOS Swift UIImage subscript extension to get pixel color
import UIKit
extension UIImage {
subscript (x: Int, y: Int) -> UIColor? {
if x < 0 || x > Int(size.width) || y < 0 || y > Int(size.height) {
return nil
}

Updates

  • Added public func pauseInteractiveTransition() to ContainerTransition
  • Updated Project Settings,
  • Updated inout parameters
  • Guard stament to prevent presentingViewController from returning nil and crashing (Flip presentation)
  • Issues Unable to go back after using Cover presentation

Swiper

UIView sublass for creating Tinder like swipe cards, with a peek view.

Usage

Check out the demo app for a detailed example.

Adding Swiper View

A Swiper view can be added via storyboard or programmatically

var swiperView = Swiper(frame: CGRect(x: 0, y: 0, width: 350, height: 350)))
extension String {
//Convert html strings to an attributed string
var html2AttributedString: NSMutableAttributedString? {
guard
let data = dataUsingEncoding(NSUTF8StringEncoding)
else { return nil }
do {
let attrStr = try NSMutableAttributedString(data: data, options: [NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType,NSCharacterEncodingDocumentAttribute:NSUTF8StringEncoding], documentAttributes: nil)
attrStr.addAttributes([NSFontAttributeName: UIFont.systemFontOfSize(17.0)], range: NSRange(location: 0, length: attrStr.length))
return attrStr
//
// ProfileViewController.swift
// Drizzle
//
// Created by George on 2016-04-17.
// Copyright © 2016 George. All rights reserved.
//
import UIKit
import IBAnimatable
--http://stackoverflow.com/a/26326006/5222077
public extension UIView {
public class func fromNib(nibNameOrNil: String? = nil) -> Self {
return fromNib(nibNameOrNil, type: self)
}
public class func fromNib<T : UIView>(nibNameOrNil: String? = nil, type: T.Type) -> T {
let v: T? = fromNib(nibNameOrNil, type: T.self)
return v!