Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Checking in the latest code version
  • Loading branch information
reallyseth committed Nov 13, 2015
commit 3f3eeb1d1909acbdfc6efb5261090021ca6ab135
1 change: 1 addition & 0 deletions Dindr
Submodule Dindr added at 9aac09
726 changes: 726 additions & 0 deletions Dindr.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Dindr.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Dindr.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions Dindr.xcworkspace/xcshareddata/Dindr.xcscmblueprint
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "EACED2723BB5600B88834009D10CCB8CD2946702",
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {

},
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"EACED2723BB5600B88834009D10CCB8CD2946702" : 0,
"3CE173A00AFA646F21499F4BA53E756FEAEB54D6" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "637F2BFC-C9BA-434D-A08A-479B2E1C1C63",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"EACED2723BB5600B88834009D10CCB8CD2946702" : "Dindr\/",
"3CE173A00AFA646F21499F4BA53E756FEAEB54D6" : "Dindr\/Dindr\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "Dindr",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Dindr.xcworkspace",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/lsecrease\/Dindr.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "3CE173A00AFA646F21499F4BA53E756FEAEB54D6"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/JBader89\/RestaurantDindr.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "EACED2723BB5600B88834009D10CCB8CD2946702"
}
]
}
36 changes: 36 additions & 0 deletions DindrTests/DindrTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// DindrTests.swift
// DindrTests
//
// Created by lsecrease on 8/9/15.
// Copyright (c) 2015 ImagineME. All rights reserved.
//

import UIKit
import XCTest

class DindrTests: XCTestCase {

override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}

func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}

func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}

}
24 changes: 24 additions & 0 deletions DindrTests/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>io.ImagineME.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
75 changes: 75 additions & 0 deletions ImagePickerSheet6.4/AnimationController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//
// AnimationController.swift
// ImagePickerSheet
//
// Created by Laurin Brandner on 25/05/15.
// Copyright (c) 2015 Laurin Brandner. All rights reserved.
//

import UIKit

class AnimationController: NSObject, UIViewControllerAnimatedTransitioning {

let imagePickerSheetController: ImagePickerSheetController
let presenting: Bool

// MARK: - Initialization

init(imagePickerSheetController: ImagePickerSheetController, presenting: Bool) {
self.imagePickerSheetController = imagePickerSheetController
self.presenting = presenting
}

// MARK: - UIViewControllerAnimatedTransitioning

func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
return 0.3
}

func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
if presenting {
animatePresentation(transitionContext)
}
else {
animateDismissal(transitionContext)
}
}

// MARK: - Animation

private func animatePresentation(context: UIViewControllerContextTransitioning) {
guard let containerView = context.containerView() else {
print ("ERROR: container view does not exist")
return
}

containerView.addSubview(imagePickerSheetController.view)

let tableViewOriginY = imagePickerSheetController.tableView.frame.origin.y
imagePickerSheetController.tableView.frame.origin.y = containerView.bounds.maxY
imagePickerSheetController.backgroundView.alpha = 0

UIView.animateWithDuration(transitionDuration(context), animations: {
self.imagePickerSheetController.tableView.frame.origin.y = tableViewOriginY
self.imagePickerSheetController.backgroundView.alpha = 1
}, completion: { _ in
context.completeTransition(true)
})
}

private func animateDismissal(context: UIViewControllerContextTransitioning) {
guard let containerView = context.containerView() else {
print ("ERROR: container view does not exist")
return
}

UIView.animateWithDuration(transitionDuration(context), animations: {
self.imagePickerSheetController.tableView.frame.origin.y = containerView.bounds.maxY
self.imagePickerSheetController.backgroundView.alpha = 0
}, completion: { _ in
self.imagePickerSheetController.view.removeFromSuperview()
context.completeTransition(true)
})
}

}
66 changes: 66 additions & 0 deletions ImagePickerSheet6.4/ImageAction.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// ImageAction.swift
// ImagePickerSheet
//
// Created by Laurin Brandner on 24/05/15.
// Copyright (c) 2015 Laurin Brandner. All rights reserved.
//

import Foundation

public enum ImageActionStyle {
case Default
case Cancel
}

public typealias Title = Int -> String

public class ImageAction {

public typealias Handler = (ImageAction) -> ()
public typealias SecondaryHandler = (ImageAction, Int) -> ()

let title: String
let secondaryTitle: Title

let style: ImageActionStyle

let handler: Handler?
let secondaryHandler: SecondaryHandler?

public convenience init(title: String, secondaryTitle: String? = nil, style: ImageActionStyle = .Default, handler: Handler? = nil, secondaryHandler: SecondaryHandler? = nil) {
self.init(title: title, secondaryTitle: secondaryTitle.map { string in { _ in string }}, style: style, handler: handler, secondaryHandler: secondaryHandler)
}

public init(title: String, secondaryTitle: Title?, style: ImageActionStyle = .Default, handler: Handler? = nil, var secondaryHandler: SecondaryHandler? = nil) {
if let handler = handler where secondaryTitle == nil && secondaryHandler == nil {
secondaryHandler = { action, _ in
handler(action)
}
}

self.title = title
self.secondaryTitle = secondaryTitle ?? { _ in title }
self.style = style
self.handler = handler
self.secondaryHandler = secondaryHandler
}

func handle(numberOfPhotos: Int = 0) {
if numberOfPhotos > 0 {
secondaryHandler?(self, numberOfPhotos)
}
else {
handler?(self)
}
}

}

func ?? (left: Title?, right: Title) -> Title {
if let left = left {
return left
}

return right
}
53 changes: 53 additions & 0 deletions ImagePickerSheet6.4/ImageCollectionViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// ImageCollectionViewCell.swift
// ImagePickerSheet
//
// Created by Laurin Brandner on 06/09/14.
// Copyright (c) 2014 Laurin Brandner. All rights reserved.
//

import UIKit

class ImageCollectionViewCell : UICollectionViewCell {

let imageView: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .ScaleAspectFill

return imageView
}()

// MARK: - Initialization

override init(frame: CGRect) {
super.init(frame: frame)

initialize()
}

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)

initialize()
}

private func initialize() {
addSubview(imageView)
}

// MARK: - Other Methods

override func prepareForReuse() {
super.prepareForReuse()

imageView.image = nil
}

// MARK: - Layout

override func layoutSubviews() {
super.layoutSubviews()

imageView.frame = bounds
}
}
56 changes: 56 additions & 0 deletions ImagePickerSheet6.4/ImagePickerCollectionView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// ImagePickerCollectionView.swift
// ImagePickerSheet
//
// Created by Laurin Brandner on 07/09/14.
// Copyright (c) 2014 Laurin Brandner. All rights reserved.
//

import UIKit

class ImagePickerCollectionView: UICollectionView {

var bouncing: Bool {
return contentOffset.x < -contentInset.left || contentOffset.x + frame.width > contentSize.width + contentInset.right
}

var imagePreviewLayout: ImagePreviewFlowLayout {
return collectionViewLayout as! ImagePreviewFlowLayout
}

// MARK: - Initialization

init() {
super.init(frame: CGRectZero, collectionViewLayout: ImagePreviewFlowLayout())

initialize()
}

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)

initialize()
}

private func initialize() {
panGestureRecognizer.addTarget(self, action: "handlePanGesture:")
}

// MARK: - Panning

@objc private func handlePanGesture(gestureRecognizer: UIPanGestureRecognizer) {
if gestureRecognizer.state == .Ended {
let translation = gestureRecognizer.translationInView(self)
if translation == CGPointZero {
if !bouncing {
let possibleIndexPath = indexPathForItemAtPoint(gestureRecognizer.locationInView(self))
if let indexPath = possibleIndexPath {
selectItemAtIndexPath(indexPath, animated: false, scrollPosition: .None)
delegate?.collectionView?(self, didSelectItemAtIndexPath: indexPath)
}
}
}
}
}

}
19 changes: 19 additions & 0 deletions ImagePickerSheet6.4/ImagePickerSheetController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// ImagePickerSheetController.h
// ImagePickerSheetController
//
// Created by Laurin Brandner on 26/05/15.
// Copyright (c) 2015 Laurin Brandner. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for ImagePickerSheetController.
FOUNDATION_EXPORT double ImagePickerSheetControllerVersionNumber;

//! Project version string for ImagePickerSheetController.
FOUNDATION_EXPORT const unsigned char ImagePickerSheetControllerVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <ImagePickerSheetController/PublicHeader.h>


Loading