I hadn't done any OS X programming for years -- the last thing I worked on was an app that presented a multi-column table view ala iTunes -- each column was sortable, resizeable, movable hideable ...
Back then you used an NSTableView and had to do a lot of verbose, error-prone glue code to make all the pieces of functionality work together.
About a week ago, my daughter's weird Mac recipe app broke -- when she reached 2,700 recipes it started randomly deleting existing recipes.
Hey, why not -- I've been playing around with Swift and here was a chance to save the day with and reacquaint myself NSTableView ...
Well, the Swift part was easy -- the table view, not so much. Everything had changed in presenting NSTAbleViews (since XCode3) -- You do most of the work in the UI (XIBS or Storyboards) with Bindings to the table -- the Bindings do all the work that you previously had to do in messy glue code.
Several problems:
not a lot of good tutorials and examples of Bindings
most of the examples used XIBS -- I wanted to use Storyboards
most of the examples wouldn't run on Xcode 6 -- required for Swift
there were zero examples of TableView Bindings in Swift.
To be honest I've never like the XCode / Interface Builder environment. It has always rubbed me the wrong way for some reason. I was actually hoping Swift might turn me around in this respect.
Well, I finally broke the code -- I was trying too hard to make it do what I wanted -- rather than let it do what I wanted:
Sounds familiar. I often have this feeling that the Cocoa developers came from another planet and do things in unconventional ways.
I can't overemphasize how significant this is -- the combination of Swift, Storyboards and Bindings have changed a messy, complex, rambling programming process -- into an elegant, succinct and focused effort.
I have a few ideas for apps so maybe I ought to look at the new technologies. In the end though Apples policies are more of a problem than the development environment. MiFi is especially troublesome.
There are 41 lines of hand-written, high-level code to do this ... 41 lines -- including blank lines for readability ... 41 lines of code ...
True but you have to admit that your example doesn't do much. It will bE very interesting to see what Swift does for the rest of code development, that is the non GUI code. I can see a lot of developers still using C++ as it is standard and portable across platforms. So the question is this, is there enough value in Swift to attract the developers currently using C++ in core progrma logic?
I don't know the answer to that but swift has a lot of resistance to over come, mostly from people concerned about their code becoming to platform dependent.
I suspect this is the kind of thing that will interest IBM and IT Pros!
I can easily envision this kind of construct being made available to iPad and iPhone developers!
The big problem right now with iPhone/iPad is the MiFi program and Apples reluctance to support drivers for third party hardware cleanly. Nothing frustrates me more than no being able to talk over iPads USB port freely.
... 41 lines of code ...
Here's a simple app window -- the second is resorted and has the columns moved and resized:
Here's the code (only 3 Classes -- the AppDelegate was generated by XCode and is unmodified):
... 41 lines ...
To save space I deleted some code and stuff but I do think you highlight Swifts potential here. You also highlight the lack of strong Apple leadership in getting Swift examples out there. That might be in part due to Swift being very beta, even Apple is telling developers to expect significant changes.
It seems weird that we haven't seen any leaks. I can't imagine Apple announcing this product before the holidays and not having it available for sale for the holidays.
Now, if you'd only made it 42 lines, you would have found the meaning of life.
Better luck next time.
LOL!
Actually. You could eliminate 10 of the 12 lines of code that were used to prime the table array, by reading it from a file or a web site -- but it would take 2 pages of narrative/comments to describe the process ;D
Now, if you'd only made it 42 lines, you would have found the meaning of life.
Better luck next time.
LOL!
Actually. You could eliminate 10 of the 12 lines of code that were used to prime the table array, by reading it from a file or a web site -- but it would take 2 pages of narrative/comments to describe the process ;D
Could you eliminate 8 instead? Then you've got a Fibonacci number.
It would make sense IF AAPL has finalized the design and concept. They aren't interfering with any of their own existing products or lines of business, just building anticipation with an early release.
.... and if the iPhone 6 family has special hardware that optimizes the experience.... If you're pimping your product, and you have special sauce for the iWatch, then you say, and we added a cool little capability to do X... Why?
For those people who like to keep their phone in their pocket. and yet be connected. to get information from your phone, and give information TO your phone.
Why would we do that? ;-) Well, we have a little thing we think you might be interested in....
Exactly, I have been saying this for a while now, leak iphone 6 parts all over the place and not a single part from a so called wearable which according to expects will sell millions, if Apple is going to sell Millions then the supply chain needs to be full.
I think it going the carplay route, you see all the watch manufactures making their own solutions to work with IOS
Just because something wasn't leaked, doesn't mean its not going to happen. I don't recall much if anything from the MacPro being leaked either before Apple gave us a sneak peak at it.
That being said, I'm not going to get excited at all until I see an official announcement from Apple that there's even going to be an event on Sept 9th.
The Mac Pro was made in the US by well paid, professional, grown ups, not underpaid Chinese teenagers with questionable ethics who steal parts.
I would love to learn that the iWatch is being made in the US, but probably not likely.
I will reserve judgement until I see it but it would take a lot to convince me to wear a watch.
Nothing is going to scream fanboy like an iWatch.
I too have long since stopped wearing a watch, but if it's as fashionable as I would expect, watch for all the celebs flashing their's and then everyone will look like a fanboy!
To be honest I've never like the XCode / Interface Builder environment. It has always rubbed me the wrong way for some reason. I was actually hoping Swift might turn me around in this respect.
Prior to about Xcode 4.3, I'd have agreed with you (especially prior to Xcode 4). However, now that everything is rolled into one window (Interface Builder isn't separate from Xcode anymore), and clang has come of age, I'd be willing to say that Xcode is one of the best IDEs I've used. Far more advanced than Visual Studio (just compare using Instruments for debugging to similar tools for VS like Xperf).
Sounds familiar. I often have this feeling that the Cocoa developers came from another planet and do things in unconventional ways.
Every programming language (and related SDK) intrinsically has it's own way of defining the world, and thus requires programmers to see things in that way. I've worked with far too many programmers who are locked into the worldview of whatever language they've used the most and judge everything relative to that. Similar to people who haven't experienced anything outside of the part of the world they grew up in.
True but you have to admit that your example doesn't do much. It will bE very interesting to see what Swift does for the rest of code development, that is the non GUI code. I can see a lot of developers still using C++ as it is standard and portable across platforms. So the question is this, is there enough value in Swift to attract the developers currently using C++ in core progrma logic?
I don't know the answer to that but swift has a lot of resistance to over come, mostly from people concerned about their code becoming to platform dependent.
AFAIK, you can't mix C++ and Swift code unless you use Obj-C++ as the glue (which is a hassle). So Swift is a non-starter for cross-platform developers (might as well just use Obj-C++).
The big problem right now with iPhone/iPad is the MiFi program and Apples reluctance to support drivers for third party hardware cleanly. Nothing frustrates me more than no being able to talk over iPads USB port freely.
Ah, so I can see you're an Android/Linux developer who, again, is locked into that worldview. You need to see things from the perspective of a company which needs to provide technical support for the OS.
One of the major reasons that Microsoft can't move Windows forward easily is because they're locked into supporting the myriad of 3rd party (often shoddy) devices/drivers that have been created over the years for Windows. Apple avoided this by only working with select partners to integrate devices with OS X (and especially so iOS) -- and only those devices could claim Mac compatibility.
All of the Linux distributions (including Android) avoid this by simply not having anyone who really provides support for the OS itself. So there's no one to contact if USB device X created by Fly-By-Night Technology no longer works with the latest release of Android. Which is fine for the crowd which is willing to just reverse-engineer the device and write their own driver for it ("Do you pine for the days when men were men and wrote their own device drivers?" - Linus Torvalds), but doesn't work for the average person who will just ring up Apple anytime anything goes wrong.
It seems weird that we haven't seen any leaks. I can't imagine Apple announcing this product before the holidays and not having it available for sale for the holidays.
At the chinese factory they were told it is a Samsung product and nobody cares, so why steal or photograph something so mundane...?
Seriously, Apple may have held off production until the announcement - this likely means the device will be in short supply throughout the end of the year, making the iWatch an even more desirable product. Meanwhile Samsung and Motorola will shit out a good supply of crap that will stink up Best Buy while laying around unsold.
The watch as a biosenseor for healthkit will be a must have; health is trending big Coke Cola just hit the market with their "Life" drink yesterday.
b) Apple doesn't put out useless crap. It will be useable and useful immediately and not a geek toy that may or may not catch on in a few years.
2) Don't know "What it looks like"
a) It will look good. Apple has earned this respect from me in this regard.
3) Don't know "How much it costs"
b) Apple doesn't gouge. It will be expensive but it'll be worth it. I've never thought I paid too much for an Apple product. Apple has earned my respect here as well.
c) Apple prices are cheap relative to their competitors. Try reselling a iPad mini (2012 - $110 gazelle) vs a Nexus 7 (2012 - $0 gazelle).... or an iPhone 5 (2012 - $175 gazelle) vs a Galaxy S3 (2012 - $30 gazelle).
You don't seem to know much about Apple, do you?
1b) Yes, they do. The "hockey-puck" mouse was useless crap. So was the Mighty Mouse. The mouse designed as a circle was useless. The Mighty Mouse trackball got dirty quickly and stopped working, requiring constant cleaning. Both were scrapped quickly. The Power Mac G4 Cube also falls into this category. Overpriced and eliminated after 1 year. The iPod Hi-Fi. The most useless product Apple ever made. The Newton. Failed at launch for being overpriced. The Palm Pilot succeeded at the time….smaller and cheaper. The eMate falls into that category too. The Newton/eMate was a niche product and then Jobs killed it immediately. The original iPod Shuffle and iPod Shuffle without buttons. The original iPod Shuffle looked like a pregnancy test and the Shuffle without buttons was useless. The buttons quickly returned.
The iWatch will be a geek toy and will not catch on because not many people wear a watch, and no one wants to recharge their watch weekly. The fitness bands and other smart watches on the market are not catching on.
2a) It may not look good. Apple has made ugly products before. The iPod Hi-Fi, the iMac Dalmatian, the iMac Flower Power, the eMac, the Power Mac G3 All-in-One (a giant molar). The "toilet seat cover" iBook from 1999. Not everything is a winning design.
3b) Apple does gouge at times. The Power Mac G4 Cube and MacBook Air both were $1,799 and underpowered and overpriced. The Power Macs and MacBook Pros were faster and hundreds less, outselling them. The iPad 16GB is still price gouging at $499, four years after introduction. Now look where the MacBook Air is priced. It is still underpowered, but at least it is considerably less expensive than the other MacBook Pros.
3c) You previously mentioned selling items on eBay, yet you compare non-Apple products on Gazelle only. Why? Why not make the same comparison with eBay completed items? You may not believe it, but Android products are popular and many people do enjoy using them. They may not have as high resale value, but they do have resale value and many of them are sold on eBay.
Failing to acknowledge Apple's faults in the past doesn't help your credibility. It just makes you sound arrogant.
To be honest I've never like the XCode / Interface Builder environment. It has always rubbed me the wrong way for some reason. I was actually hoping Swift might turn me around in this respect.
I agree! IB/NIB/XIB implimentation seemed like half a job well done! You still had to do so much in code, and make it match up with IB — that many early XCode programerrs just said screw it — I can do it easier in code (often cut/paste). I think that Swift and Storyboards might just turn that around.
Sounds familiar. I often have this feeling that the Cocoa developers came from another planet and do things in unconventional ways.
It’s called job security through refactoring
True but you have to admit that your example doesn't do much.
Well, yes and no … First, consider that a large number of apps use a table view — even considering that on iOS the table is presentsd over several screens.
Before I figured out that I was fighting the system I had hundreds of lines of code in my ViewController trying to define, load, sort and reload the table — I hadn’t even gotten into moving or resizing columns, etc. The Bindings take care of all that.
The lines I deleted contained the table datasource, delegate, number of cells in section, cell for row at index path, sort descriptors … cha, cha cha! They’re gone — no longer my problem — just cruft to clutter the mind.
It will bE very interesting to see what Swift does for the rest of code development, that is the non GUI code. I can see a lot of developers still using C++ as it is standard and portable across platforms. So the question is this, is there enough value in Swift to attract the developers currently using C++ in core progrma logic?
I don't know the answer to that but swift has a lot of resistance to over come, mostly from people concerned about their code becoming to platform dependent.
As Apple stated, the value to Swift is fast, safe readable/maintainable code — if it compiles it wil run safely. I understand the resistance — it is difficult to unlearn what you’ve been doing successfully for years. I think that productivity will be the reason that causes current developers to migrate their new development efforts to Swift. (A similar problem faced FCP 7 users when FCPX was announced — now, FCPX editors can run circles around FCP 7 editors). It’s adapt or die (professionally).
As to the platform dependence — I suspect that in about 12-18 months Swift will be stable and proven. I think for Swift to reach full potential it will need to be platform agnostic ala WebKit. Possibly, this could be implemented via the cloud — if you can edit spreadsheets, movies, write manuals online — why not apps?
To save space I deleted some code and stuff but I do think you highlight Swifts potential here. You also highlight the lack of strong Apple leadership in getting Swift examples out there. That might be in part due to Swift being very beta, even Apple is telling developers to expect significant changes.
Actually, I am quite impressed with the fact that they made it available before it was ready — like FCPX or even preannouncing the MacPro. This shows me that Apple is adapting to the times … Sometimes it is better to release an imperfect product that can be refined and grow with the times — rather than wait until it’s perfect, and miss the window of opportunity entirely. This is especially true of software.
Actually. You could eliminate 10 of the 12 lines of code that were used to prime the table array, by reading it from a file or a web site -- but it would take 2 pages of narrative/comments to describe the process ;D
Could you eliminate 8 instead? Then you've got a Fibonacci number.
Fibonacci ... Nah! I was shooting for the aborigine series: few and many!
Comments
I don't know the answer to that but swift has a lot of resistance to over come, mostly from people concerned about their code becoming to platform dependent. The big problem right now with iPhone/iPad is the MiFi program and Apples reluctance to support drivers for third party hardware cleanly. Nothing frustrates me more than no being able to talk over iPads USB port freely.
To save space I deleted some code and stuff but I do think you highlight Swifts potential here. You also highlight the lack of strong Apple leadership in getting Swift examples out there. That might be in part due to Swift being very beta, even Apple is telling developers to expect significant changes.
This is irrefutable proof there'll be a 5.5" iPhone.
/s
LOL!
Actually. You could eliminate 10 of the 12 lines of code that were used to prime the table array, by reading it from a file or a web site -- but it would take 2 pages of narrative/comments to describe the process ;D
I thought the 9th date was based on a rumour from re/code. Has there more confirmation of the date since?
I’d say the 1st, but that’s Labor Day. So the 2nd. And then 19th for release.
Nope. At this point, I don’t think we’ll even see evidence of the vacation blackout until the day of announcement.
That literally makes no sense. But ok.
As you were.
bf is a relatively known abbreviation for boyfriend. I apologize for my response being over your head.
He's not going to out a new Apple product. But if it wasn't happening he might say "nope". I would take silence to mean "yep".
Yeee- upp!
It was more below the belt. And you don’t get to troll and be condescending. Pick one or the other and then go away.
The iWatch(es) are great news ...
But I think the best is yet to come!
... 41 lines of code ...
Here's The Storyboard:
... 41 lines ...
Impressive!
Now, if you'd only made it 42 lines, you would have found the meaning of life.
Better luck next time.
LOL!
Actually. You could eliminate 10 of the 12 lines of code that were used to prime the table array, by reading it from a file or a web site -- but it would take 2 pages of narrative/comments to describe the process ;D
Could you eliminate 8 instead? Then you've got a Fibonacci number.
bf is a relatively known abbreviation for boyfriend. I apologize for my response being over your head.
Oh, it wasn't over my head. I have kids who use similar terms.
It would make sense IF AAPL has finalized the design and concept. They aren't interfering with any of their own existing products or lines of business, just building anticipation with an early release.
.... and if the iPhone 6 family has special hardware that optimizes the experience.... If you're pimping your product, and you have special sauce for the iWatch, then you say, and we added a cool little capability to do X... Why?
For those people who like to keep their phone in their pocket. and yet be connected. to get information from your phone, and give information TO your phone.
Why would we do that? ;-) Well, we have a little thing we think you might be interested in....
and that's
a
variation
of
One.... More....
Thing!
No parts leak yet though.
Exactly, I have been saying this for a while now, leak iphone 6 parts all over the place and not a single part from a so called wearable which according to expects will sell millions, if Apple is going to sell Millions then the supply chain needs to be full.
I think it going the carplay route, you see all the watch manufactures making their own solutions to work with IOS
I too have long since stopped wearing a watch, but if it's as fashionable as I would expect, watch for all the celebs flashing their's and then everyone will look like a fanboy!
To be honest I've never like the XCode / Interface Builder environment. It has always rubbed me the wrong way for some reason. I was actually hoping Swift might turn me around in this respect.
Prior to about Xcode 4.3, I'd have agreed with you (especially prior to Xcode 4). However, now that everything is rolled into one window (Interface Builder isn't separate from Xcode anymore), and clang has come of age, I'd be willing to say that Xcode is one of the best IDEs I've used. Far more advanced than Visual Studio (just compare using Instruments for debugging to similar tools for VS like Xperf).
Every programming language (and related SDK) intrinsically has it's own way of defining the world, and thus requires programmers to see things in that way. I've worked with far too many programmers who are locked into the worldview of whatever language they've used the most and judge everything relative to that. Similar to people who haven't experienced anything outside of the part of the world they grew up in.
I don't know the answer to that but swift has a lot of resistance to over come, mostly from people concerned about their code becoming to platform dependent.
AFAIK, you can't mix C++ and Swift code unless you use Obj-C++ as the glue (which is a hassle). So Swift is a non-starter for cross-platform developers (might as well just use Obj-C++).
Ah, so I can see you're an Android/Linux developer who, again, is locked into that worldview. You need to see things from the perspective of a company which needs to provide technical support for the OS.
One of the major reasons that Microsoft can't move Windows forward easily is because they're locked into supporting the myriad of 3rd party (often shoddy) devices/drivers that have been created over the years for Windows. Apple avoided this by only working with select partners to integrate devices with OS X (and especially so iOS) -- and only those devices could claim Mac compatibility.
All of the Linux distributions (including Android) avoid this by simply not having anyone who really provides support for the OS itself. So there's no one to contact if USB device X created by Fly-By-Night Technology no longer works with the latest release of Android. Which is fine for the crowd which is willing to just reverse-engineer the device and write their own driver for it ("Do you pine for the days when men were men and wrote their own device drivers?" - Linus Torvalds), but doesn't work for the average person who will just ring up Apple anytime anything goes wrong.
At the chinese factory they were told it is a Samsung product and nobody cares, so why steal or photograph something so mundane...?
Seriously, Apple may have held off production until the announcement - this likely means the device will be in short supply throughout the end of the year, making the iWatch an even more desirable product. Meanwhile Samsung and Motorola will shit out a good supply of crap that will stink up Best Buy while laying around unsold.
The watch as a biosenseor for healthkit will be a must have; health is trending big Coke Cola just hit the market with their "Life" drink yesterday.
1) Don't know "What it does"
b) Apple doesn't put out useless crap. It will be useable and useful immediately and not a geek toy that may or may not catch on in a few years.
2) Don't know "What it looks like"
a) It will look good. Apple has earned this respect from me in this regard.
3) Don't know "How much it costs"
b) Apple doesn't gouge. It will be expensive but it'll be worth it. I've never thought I paid too much for an Apple product. Apple has earned my respect here as well.
c) Apple prices are cheap relative to their competitors. Try reselling a iPad mini (2012 - $110 gazelle) vs a Nexus 7 (2012 - $0 gazelle).... or an iPhone 5 (2012 - $175 gazelle) vs a Galaxy S3 (2012 - $30 gazelle).
You don't seem to know much about Apple, do you?
1b) Yes, they do. The "hockey-puck" mouse was useless crap. So was the Mighty Mouse. The mouse designed as a circle was useless. The Mighty Mouse trackball got dirty quickly and stopped working, requiring constant cleaning. Both were scrapped quickly. The Power Mac G4 Cube also falls into this category. Overpriced and eliminated after 1 year. The iPod Hi-Fi. The most useless product Apple ever made. The Newton. Failed at launch for being overpriced. The Palm Pilot succeeded at the time….smaller and cheaper. The eMate falls into that category too. The Newton/eMate was a niche product and then Jobs killed it immediately. The original iPod Shuffle and iPod Shuffle without buttons. The original iPod Shuffle looked like a pregnancy test and the Shuffle without buttons was useless. The buttons quickly returned.
The iWatch will be a geek toy and will not catch on because not many people wear a watch, and no one wants to recharge their watch weekly. The fitness bands and other smart watches on the market are not catching on.
2a) It may not look good. Apple has made ugly products before. The iPod Hi-Fi, the iMac Dalmatian, the iMac Flower Power, the eMac, the Power Mac G3 All-in-One (a giant molar). The "toilet seat cover" iBook from 1999. Not everything is a winning design.
3b) Apple does gouge at times. The Power Mac G4 Cube and MacBook Air both were $1,799 and underpowered and overpriced. The Power Macs and MacBook Pros were faster and hundreds less, outselling them. The iPad 16GB is still price gouging at $499, four years after introduction. Now look where the MacBook Air is priced. It is still underpowered, but at least it is considerably less expensive than the other MacBook Pros.
3c) You previously mentioned selling items on eBay, yet you compare non-Apple products on Gazelle only. Why? Why not make the same comparison with eBay completed items? You may not believe it, but Android products are popular and many people do enjoy using them. They may not have as high resale value, but they do have resale value and many of them are sold on eBay.
Failing to acknowledge Apple's faults in the past doesn't help your credibility. It just makes you sound arrogant.
I agree! IB/NIB/XIB implimentation seemed like half a job well done! You still had to do so much in code, and make it match up with IB — that many early XCode programerrs just said screw it — I can do it easier in code (often cut/paste). I think that Swift and Storyboards might just turn that around.
It’s called job security through refactoring
Well, yes and no … First, consider that a large number of apps use a table view — even considering that on iOS the table is presentsd over several screens.
Before I figured out that I was fighting the system I had hundreds of lines of code in my ViewController trying to define, load, sort and reload the table — I hadn’t even gotten into moving or resizing columns, etc. The Bindings take care of all that.
The lines I deleted contained the table datasource, delegate, number of cells in section, cell for row at index path, sort descriptors … cha, cha cha! They’re gone — no longer my problem — just cruft to clutter the mind.
As Apple stated, the value to Swift is fast, safe readable/maintainable code — if it compiles it wil run safely. I understand the resistance — it is difficult to unlearn what you’ve been doing successfully for years. I think that productivity will be the reason that causes current developers to migrate their new development efforts to Swift. (A similar problem faced FCP 7 users when FCPX was announced — now, FCPX editors can run circles around FCP 7 editors). It’s adapt or die (professionally).
As to the platform dependence — I suspect that in about 12-18 months Swift will be stable and proven. I think for Swift to reach full potential it will need to be platform agnostic ala WebKit. Possibly, this could be implemented via the cloud — if you can edit spreadsheets, movies, write manuals online — why not apps?
Actually, I am quite impressed with the fact that they made it available before it was ready — like FCPX or even preannouncing the MacPro. This shows me that Apple is adapting to the times … Sometimes it is better to release an imperfect product that can be refined and grow with the times — rather than wait until it’s perfect, and miss the window of opportunity entirely. This is especially true of software.
Fibonacci ... Nah! I was shooting for the aborigine series: few and many!