This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CamViewController | |
// self.performSegue(withIdentifier: "preview", sender: self) | |
// leads to PreviewViewController | |
// PreviewViewController.swift | |
import UIKit | |
import AVKit | |
import AVFoundation | |
class PreviewViewController: UIViewController { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import AVFoundation | |
import AssetsLibrary | |
import Photos | |
import MobileCoreServices | |
import FirebaseAuth | |
import CoreLocation | |
import RecordButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: iOS9.0 - rewrite using Photos framework | |
PHPhotoLibrary.shared().performChanges({ | |
let request = PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: outputFileURL) | |
}, completionHandler: { (success, error) in | |
if !success { NSLog("error creating asset: \(error)") } | |
}) | |
// ALAssetsLibrary().writeVideoAtPath(toSavedPhotosAlbum: outputFileURL, completionBlock: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func collectionView(collectionView: UICollectionView, | |
layout collectionViewLayout: UICollectionViewLayout, | |
sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { | |
let flowLayout = collectionViewLayout as! UICollectionViewFlowLayout | |
let totalSpace = flowLayout.sectionInset.left | |
+ flowLayout.sectionInset.right | |
+ (flowLayout.minimumInteritemSpacing * CGFloat(numberOfItemsPerRow - 1)) | |
let size = Int((collectionView.bounds.width - totalSpace) / CGFloat(numberOfItemsPerRow)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NewPostViewController.swift | |
// didyoulift | |
// | |
// Created by Alan Jaw on 3/2/16. | |
// Copyright © 2016 Alan Jaw. All rights reserved. | |
// | |
import UIKit | |
import Firebase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data: NSData = NSData() | |
if let image = photoImageView.image { | |
data = UIImageJPEGRepresentation(image,0.1)! | |
} | |
let base64String = data.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.Encoding64CharacterLineLength) | |
let user: NSDictionary = ["name":name!,"dob":dateOfBirthTimeInterval, "photoBase64":base64String] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getFBUserInfo() { | |
let facebookRequest = FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "name, gender, picture, birthday, first_name, last_name"]) | |
facebookRequest.startWithCompletionHandler { (connection: FBSDKGraphRequestConnection!, result, error) -> Void in | |
if error == nil { | |
print ("result: \(result)") | |
var r = result as! NSDictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// | |
// Created by Alan Jaw on 2/29/16. | |
// Copyright © 2016 Alan Jaw. All rights reserved. | |
// | |
import UIKit | |
import FBSDKLoginKit | |
import Firebase |
NewerOlder