Flux is both one of the most popular and one of the least understood topics in current web development. This guide is an…
Same point as instant-classic https://developer.apple.com/videos/play/wwdc2014-229/
Sade Olutola

PR's Tumblrdome

oozey mess
d e v o n

Love Begins
$LAYYYTER
Aqua Utopia|海の底で記憶を紡ぐ

Kiana Khansmith
i don't do bad sauce passes

pixel skylines
No title available
Xuebing Du
Not today Justin
hello vonnie

No title available
will byers stan first human second

No title available
Cosimo Galluzzi
noise dept.
he wasn't even looking at me and he found me

seen from United States
seen from United States
seen from United States
seen from United States

seen from France

seen from Malaysia

seen from Singapore
seen from United States

seen from United States
seen from United States
seen from Japan
seen from United States
seen from Poland

seen from United States

seen from United States

seen from Türkiye
seen from Australia
seen from Türkiye

seen from Türkiye
seen from Türkiye
@sandersonmichael
Flux is both one of the most popular and one of the least understood topics in current web development. This guide is an…
Same point as instant-classic https://developer.apple.com/videos/play/wwdc2014-229/
Subclassing and Organizing Tiny Classes in UITableView
Customizing Header and Footer of Table View in iOS8 with Swift
In a Table View you can customize the header and footer by replacing these with your own custom views. In this tutorial we are going to fill the table with some sample country names and use custom UIViews to create a header and a footer of our Table View. This tutorial is built in iOS 8.1 and Xcode 6.1
Two issues--not problems, more riffs--with this tutorial:
Why subclass UITableViewController?
Why create a file for CustomHeaderCell?
1. Literally, I think the only thing subclassing UITableViewController instead of UIViewController does is to automatically create the outlet to a UITableView when the class is set in IB.
On the downside, you have to mark all of the UITableViewDataSource Protocol methods "override". Subclassing and overriding methods has proven time and again to be problematic, most clearly stated in Design Pattens. It's harmless here, but it's annoying as a tutorial example because it's just as easy to create a View Controller and declare it supports the UITableViewDataSource protocol, which is a much better way/habit of doing anything if possible.
2. While "avoid subclassing" is august advice from the venerable Design Patterns, the desire to avoid creating a file for every single custom object is a pet peeve of mine. In Objective C, of course, there's no reason why one text file can't contain multiple classes, each with their own @interface and @implementation. The distinction between .h and .m is the difference public and private information (still an important distinction to make) and, I vaguely recall when first being taught C++ in 1996 when I was 15 years old, at one point important to the compiler.
Anyway, organizing files in a project by class and giving each class its own .h and .m file is a convention. It's such a convention that Xcode calls the file creation under New->File "Cocoa Touch Class", even though creating the file doesn't create the class, it just helps you out by pre-writing some methods. It's the conventional way of organizing projects in object-orientaed programming. The .h and .m convention is swept into the dustbin of history, it's time to look at this one as well.
And custom headers for the UITAbleView is the perfect place to do so. Here, we are creating an entire class file, that will take up space in our listing and our projects, to set one single property.
It would be just as simple to put, above the class declaration of our TableViewDataSourceProtocolDelegate,
class CustomHeaderCell: UITableViewCell {
@IBOutlet weak var headerLabel: UILabel!
}
Done.
Cocoa development often necessitates many of these "minor" classes, that just take a few properties, and often have a single purpose. It doesn't have to go in the particular UITableViewDataSource, but all TableViewCells variations could go in their own fail, made available to TableViewDataSources that need them.
Since iOS app projects can get to be sprawling affairs with hundreds of classes, the willingness to experiment with organization will continue to move iOS development forward.
Race conditions and Advanced iOS Architecture in UITableViewController
Yesterday I attended the fantastic Functional Swift conference in Brooklyn, and had a chance to ask a question of one of the presenters, Andy Matuschak, who until recently worked for Apple on UIKit and gave the great 2014 WWDC talk, Session 229, "Advanced iOS Application Architecture and Patterns."
So I was able to ask about something that's been bugging me (haha) about UITableView since seeing his WWDC talk. (It's not core functional programming issue, more about dangers of shadowy, unseen caches.) After looking it up today, I see the issue isn't in the API, it's in the provided code included automatically in a new project for Master-Detail in a UITableViewController. It's the prewritten UITableViewDelgate method called in response to user interaction managed by the table:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { [self.objects removeObjectAtIndex:indexPath.row]; [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; } else if (editingStyle == UITableViewCellEditingStyleInsert) { // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. } }
Notably, under "if (editingStyle == UITableViewCellEditingStyleDelete)" there are 2 lines of code that
Deletes the item from the data source, an NSMutableArray self.objects.
Tells the tableview to delete the row with an animation.
Here we have the perfect example identified in Matuschak's WWDC talk: Code fired in response to the user interaction updates the model, and separately alters the UI.
Experience with UITableView makes clear why this example is not nitpicking or hypothetical: After the animation, the tableview will immediately call its datasource, (ignoring sections) including numberOfRowsInSection:
If the implementation of this data source method gets its answers from the ultimite data source, if for any reason that data source hasn't finished updating the data source deletion, there will be an invalid number of rows exception.
Worse, if the delay to update the data source is variable and only sometimes fails to update by the time numberOfRowsInSection: is called, the bug could only happen sometimes and be hard to reproduce.
In my GTD to-do app that uses core data, I'm using a fetchedResultsController In my own code, following the plan of the WWDC talk, I've reduced the commitEditingStyle: (which only handles delete) to only fire off a line of code to the managedObjectContext to delete the object given by the self.fetched results controller, and then, in the fetchedResultsControllerDelegate, have the change made.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the row from the data source [self.managedObjectContext deleteObject:[self.fetchedResultsControllerForProjects objectAtIndexPath:indexPath]]; } } -(void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath switch(type) { case NSFetchedResultsChangeDelete: { [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; } ...
So he truth resides in Core Data, and the UI won't be updated until the change has been made.
Obviously, the provided code for UITableViewController is boilerplate, prewritten code for demonstration purposes. And deleteObjectAtIndex has no BOOL return. Still, this is the kind of pattern of UI making two calls, one for animation and one to update the data source, that will lead to unwieldy and hard-to-debug programs.
Edit: I have since noticed that this is in fact the prewritten code on UITableViews if you check "Use Core Data," although I had been working with Collection Views and had to suss it out myself; how you implement this on Collection Views, which lack beginUpdates: and endUpdates:, is another post.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { [self.objects removeObjectAtIndex:indexPath.row]; [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; } else if (editingStyle == UITableViewCellEditingStyleInsert) { // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. } }
If there is one thing I learned while living on the Upper East Side many years ago, it’s that York Avenue is quite a hike from the subway (at least as far as hikes from subways in Manhattan go). That fact can sometimes help keep housing prices down, at least until the 2nd Avenue Line comes in.
...
My free iPhone app gives walking directions to the nearest subway entrance, which I'm surprised every transit app doesn't do.
Yahoo! weather just looks shitty
Funny review of Swing Copters game on the AppStore :D
via feedbacksfromhell:
Download
Just a little under 31 years ago, I played a key role in a conspiracy theory that grew up around a passenger plane downed by a Russian missile. Trust me, I did not mean to be involved.
On September 1, 1983, Korean Airlines flight 007, a Boeing 747 with 269 passengers, was shot down over the...
End of the Bosporus.
Articles
Bug Splitting, by Russell Ivanovic
How Apple Cheats, by Mark Sands
Things you didn’t know about GIT, by Matheus Lima
How Dropbox Uses C++ for Cross-Platform iOS and Android Development, by Ole Begemann
Controls/Tools
MGConferenceDatePicker, by Matteo Gobbi
...
Great stuff here.
Three months ago we announced a new Crashlytics Labs project: a beta distribution tool to simplify the process of sharing apps with testers…. we’re excited to announce the official launch of Beta by Crashlytics.
Beta out of Beta.
The potential for linguistic confusion was my first thought:
"Install the latest the beta."
"On beta?"
"No, the beta on beta’s not the latest beta, that’s the old beta."
Back in May, Twitter user @hirakujira was poking around in the code for Lianwo, the Chinese version of the popular mobile chat app LINE, when he noticed a curious line: “<key>warning.badWords</key>” followed by a string that read in Chinese: “Your message contains sensitive words, please adjust...
Z. Love it.
untitled-184
Source: Runs With Scissors
This has the be the cheapest/ugliest sign. This is an old picture..someone has already stabbed a hole in it.
Prince makes his way towards the exit of an MTA train as it approaches his stop, which is also his street. He is gesturing towards the door because most people on NYC MTA trains are crazy and can’t just assume that someone else might be getting off the train, through the door, when it stops. That might be accurate, Prince, but some people like to hang on to the pole and keep their feet firmly planted until the train has come to a complete stop, so as not to hurt themselves. It’s a tricky situation but it basically boils down to the fact that nobody in this city gives anyone else the benefit of the doubt, ever.