Skip to content

Instantly share code, notes, and snippets.

View ivangodfather's full-sized avatar
🍂

Ivan Ruiz ivangodfather

🍂
View GitHub Profile
iMac-Apps:UUUPS alex$ ls *.h
Bridge.h
iMac-Apps:UUUPS alex$ pwd
/Users/alex/Projects RW/iOS/UUUPS/UUUPS
iMac-Apps:UUUPS alex$
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
UIApplication.sharedApplication().statusBarStyle = .LightContent
return true
}
Inside a VC
override func viewDidLoad() {
super.viewDidLoad()
setNeedsStatusBarAppearanceUpdate()
class ListCommentsCells: UITableViewCell {
@IBOutlet weak var tableView: UITableView!
var comments: [Comment]? {
didSet {
println("WHEN SETTING COUNT HERE \(comments?.count)")
tableView.reloadData()
}
}
extension MainViewController: UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let friend:Friend? = friends[indexPath.row]
var cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as UserCell
cell.setInitial(friend: friend)
return cell
}
if friend.photo != nil {
userImageView.image = UIImage(data: friend.photo)
}
Model.updateChangingFriend(friend, completion: { (displayName, image) -> () in
println("\(UIImageJPEGRepresentation(image, 1).length) y \(UIImageJPEGRepresentation(self.userImageView.image, 1).length) ")
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.userImageView.image = image //TODO WTF?
})
})
Model.updateImage(friend, completion: { (image) -> () in
println("\(UIImageJPEGRepresentation(image, 1).length) y \(UIImageJPEGRepresentation(self.userImageView.image, 1).length) ")
dispatch_async(dispatch_get_main_queue(), { () -> Void in
//self.userImageView.image = image //TODO WTF?
})
})
So in my console if i remove the comment of the #4 line i get in my three cells:
241191 y 241191
298551 y 298551
class func getCenterWithId(id: Int?) -> Center? {
let level = (model?.centers.filter() { $0.id == id })?.first?
if level == nil {
println("Error, could not find level with id!")
return nil
}
return level
}
class func getFamilyWithId(id: Int?) -> Family? {
class Incident {
var idIncident: Int
var title: String
var description: String
var familyId: Int
var cancelationCause: String
var cancelationDate: String
var levelId: Int
var statusId: Int
import Foundation
import CoreData
class Friend: NSManagedObject {
@NSManaged var currentUsername: String!
@NSManaged var displayName: String!
@NSManaged var photo: NSData!
@NSManaged var username: String!
@NSManaged var messages: NSOrderedSet
@objc protocol ModelProtocol {
class func getById<A>(id: Int) -> A
}
class Class1: ModelProtocol {
class func getById<A>(id: Int) -> A {
return Class1()
}
}