Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
brap
Aug 23, 2004

Grimey Drawer
Is there something collectionview does that stackview and a scrollview does not? (I know a lot of people can't target iOS 9 as a minimum yet, but still.)

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Reuse.

Doh004
Apr 22, 2007

Mmmmm Donuts...
I mean, UICollectionViewFlowLayout handles like 95% of the work for me most of the time so...

UICollectionViews 4 lyfe :whatup:

brap
Aug 23, 2004

Grimey Drawer
So I'm starting to play around with watch apps, and I'm wondering how I should be achieving the typical workflow of "make a network call to fetch some data, then show it in a table." I'm making the network call and getting the data just fine, but updating the table is kinda proving impossible. I can't update the number of rows in the table in my callback--I get an EXC_BAD_ACCESS, and I'm pretty sure I'm dispatching back to the main thread when my network stuff is done with. Anything obviously wrong stand out about this?

Doctor w-rw-rw-
Jun 24, 2008

fleshweasel posted:

Is there something collectionview does that stackview and a scrollview does not? (I know a lot of people can't target iOS 9 as a minimum yet, but still.)

Rich animated transitions and reuse with complex custom layouts, queriable for visible items.

Doctor w-rw-rw- fucked around with this message at 04:56 on Mar 16, 2017

dc3k
Feb 18, 2003

what.

fleshweasel posted:

So I'm starting to play around with watch apps, and I'm wondering how I should be achieving the typical workflow of "make a network call to fetch some data, then show it in a table." I'm making the network call and getting the data just fine, but updating the table is kinda proving impossible. I can't update the number of rows in the table in my callback--I get an EXC_BAD_ACCESS, and I'm pretty sure I'm dispatching back to the main thread when my network stuff is done with. Anything obviously wrong stand out about this?

EXC_BAD_ACCESS is all you get? No stack trace? Are exception breakpoints on?

brap
Aug 23, 2004

Grimey Drawer
I got to the bottom of it. It's because my table row class was descending from WKInterfaceController instead of NSObject. The bottom of my stack trace was WKInterfaceController.

edit: Sorry if I'm flooding the forum with dumb questions, but the next thing I'm wondering about is how to share user preferences between the watch and phone. It looks like App Groups doesn't suffice for this any more and you need to actually use the Watch Connectivity framework to have the watch request information from the phone. Should I have my watch app always ask the phone to make network requests for it? Should I be trying to use some kind of preferences synchronization so the watch can do its little task when the phone's out of range? It seems like users will almost always have their phones on and available with their watch.

brap fucked around with this message at 06:50 on Mar 16, 2017

Doctor w-rw-rw-
Jun 24, 2008

fleshweasel posted:

It seems like users will almost always have their phones on and available with their watch.

I regularly step away from my phones at my desk with my watch still on. Pay attention to the corner cases sooner and they'll be smaller when they come back to bite you later.

FAT32 SHAMER
Aug 16, 2012



My boss is hoping to not have to buy me the company's first Mac by using a VM... is this going to work for simple app development or will I have to convince him to at least buy the higher end Mac mini

I have a feeling it's at best going to be painfully slow

Doctor w-rw-rw-
Jun 24, 2008

funny Star Wars parody posted:

My boss is hoping to not have to buy me the company's first Mac by using a VM... is this going to work for simple app development or will I have to convince him to at least buy the higher end Mac mini

I have a feeling it's at best going to be painfully slow
Having done this, yes: macOS in a VM feels like rear end. Maybe it relies on having a decent video card to feel good, or maybe there's something about the mouse drivers, I don't know. But it is sluggish. You probably couldn't have it feel not sluggish without spending what you would on a mac.

Also, you'll be required to hack the hypervisor in ways that at the least break licensing terms, possibly the law, to allow a macOS guest, and even if you do that, good luck finding install media. Chances are you're going to have to pirate that. If opening the company up to possible liability is worth a couple hundred dollars...that's troubling. To actually deploy Apple stuff, Xcode will need you to log in with your Apple ID, so there's a straightforward way for Apple – at least in theory – to identify you and figure out you're doing something wrong.

Also, the higher-end mac mini is still not necessarily the best machine for the value. They were last refreshed in 2014. The lowest-end macbook pro (Late 2016) will be beat the best mac mini. by a lot. $1500 vs $1000. But maybe that can wait if you need to do iOS just to prove it's worth further investment.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

funny Star Wars parody posted:

My boss is hoping to not have to buy me the company's first Mac by using a VM... is this going to work for simple app development or will I have to convince him to at least buy the higher end Mac mini

I have a feeling it's at best going to be painfully slow

:sever:
Your company is trying to get around spending a modest amount of money on tools you need to do your job.
You're also in violation of the EULA if you're running mac VMs on non-macs. Not sure what the ramifications for that are.

FAT32 SHAMER
Aug 16, 2012



That is kind of what I thought. Are the lower end iMacs going to work better than the $1499 MBP?

Data Graham
Dec 28, 2009

📈📊🍪😋



I'd buy secondhand a lot sooner than I'd try hacking a VM.

FAT32 SHAMER
Aug 16, 2012



I showed my boss these posts and he's currently ordering me a 15" MBP, so i guess that works out pretty good. thanks everyone!

fankey
Aug 31, 2001

Any suggestions on how to track down why after updating to XCode 8.2.1, the IDE completely locks up with 99% CPU usage 10 seconds every time loading my project? This is a standard ObjC project without any Swift, CocoaPods, etc. I don't see anything interesting the the Console logs.

Edit: It finally came back after 45 minutes. I think one of the issues is that I'm checking out a sparse git checkout and XCode thinks there are 10,000s of missing files which it feels necessary to report to me, even though none of these file are referenced in the Workspace. Is it possible to work with sparse checkouts in XCode or am I going to be frustrated?

fankey fucked around with this message at 23:35 on Mar 17, 2017

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

fankey posted:

Any suggestions on how to track down why after updating to XCode 8.2.1, the IDE completely locks up with 99% CPU usage 10 seconds every time loading my project? This is a standard ObjC project without any Swift, CocoaPods, etc. I don't see anything interesting the the Console logs.

Edit: It finally came back after 45 minutes. I think one of the issues is that I'm checking out a sparse git checkout and XCode thinks there are 10,000s of missing files which it feels necessary to report to me, even though none of these file are referenced in the Workspace. Is it possible to work with sparse checkouts in XCode or am I going to be frustrated?

Unfortunately I don't know the state of sparse checkout support. That certainly sounds like something worth reporting, however. I'll file a bug right now but I'd suggest you do so as well so you can request status etc.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

leper khan posted:

:sever:
Your company is trying to get around spending a modest amount of money on tools you need to do your job.
You're also in violation of the EULA if you're running mac VMs on non-macs. Not sure what the ramifications for that are.

This.

I mean I know from experience that this doesn't always work out ideally, but one-time equipment/tooling should be an easy ask when the alternative is days/weeks of loving around.

funny Star Wars parody posted:

I showed my boss these posts and he's currently ordering me a 15" MBP, so i guess that works out pretty good. thanks everyone!

:toot:

uncle blog
Nov 18, 2012

I have a tableview of cells, and I would like the first cell to be highlighted when the view loads. What's the easiest/best way to do this in Swift?

Edit:
Found it!

uncle blog fucked around with this message at 09:46 on Mar 20, 2017

Doctor w-rw-rw-
Jun 24, 2008
Anyone know when Xcode 8.3 is landing? Some coworkers will need it soon.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
edit: Adding .withRenderingMode(.alwaysOriginal) fixed the below. It was rendering the entire image as a template, thus tinting away the letters. I may have noticed if the background color for my image did not match the tint color.


What on Earth am I missing here with UIBarButtonItem?

I am rendering an image with UIGraphicsGetImageFromCurrentImageContext of text drawn on a circle. If I make a UIBarButtonItem with that image:

Swift code:
self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: avatar.avatarImage(), style: .plain, target: nil, action: nil)
.. the circle is there, but the text is not:



If I instead set the UIBarButtonItem's custom view to a UIImageView with that same image:

Swift code:
self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: UIImageView(image: avatar.avatarImage()))
.. it works:




Sure, I can make this work, but what ridiculous Mondayism am I committing here?

This code is all main thread. I have even tried displaying the same image used to make the empty blue circle in another view, and the letters are there.

ManicJason fucked around with this message at 21:25 on Mar 20, 2017

Vesi
Jan 12, 2005

pikachu looking at?
I tried with one of my barbuttons and it worked as expected

code:
    func underlineIcon(image: UIImage) -> UIImage {
        UIGraphicsBeginImageContext(image.size)
        defer {
            UIGraphicsEndImageContext()
        }
        let rect = CGRect(origin: CGPoint.zero, size: image.size)
        image.draw(in: rect)
        #imageLiteral(resourceName: "ic_underline").draw(in: rect, blendMode: CGBlendMode.normal, alpha: 1.0)
        ("foo" as NSString).draw(in: rect, withAttributes: nil)
        return UIGraphicsGetImageFromCurrentImageContext()!
    }
edit: vv thanks, totally forgot about defer

Vesi fucked around with this message at 01:03 on Mar 21, 2017

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Missed a good chance there to use defer.

dc3k
Feb 18, 2003

what.
I swear, this used to work fine, but now displayNameForKey:value: is just giving me back nil. I'm trying to get the currency symbol for a currency code in a locale.

code:
  public func symbol(
    forCurrency currencyCode: String,
    locale: Locale = Locale.autoupdatingCurrent) -> String
  {
    let symbol = (locale as NSLocale).displayName(forKey: NSLocale.Key.currencySymbol, value: currencyCode) {
    
    return symbol ?? currencyCode
  }
I'm very confused. I ran this through every single currency in Locale.commonIsoCurrencyCodes and the only currency codes that didn't result in nil were AUD (I passed in en_AU locale) and SCR, which gave back Rs. I have the same issue using Objective-C, so I don't think it's a problem with the cast to NSLocale from Locale

:wtf:

dc3k
Feb 18, 2003

what.
lol wtf en_CA does it right but en_AU doesn't. localization loving sucks

uncle blog
Nov 18, 2012

Is there a way to loop through the icons in an asset folder? I want to generate cells in a collection view for each icon in a specific folder. Items which all have different names. I used to cheese this by naming the icons 0 - [number of icons].

Doctor w-rw-rw-
Jun 24, 2008
1) Put the images in a folder instead of an Asset catalog
Pro: easy
Con: you lose out on the benefits of using Asset catalogs

2) Write a Script run phase which outputs a list of the image names into a text file
Pro: Asset catalog
Con: Eventually doesn't scale, gives your project more moving parts

3) Prefix your images, Foobar_1,Foobar_2,...,Foobar_10, and so on
Pro: Predictable
Con: Still have to keep track of the maximum number

4) Name the files what they are and make an array of their names in code
Pro: If you have a weird off by one error or something you won't be staring at a bunch of numbers utterly confused
Con: Name collisions for similar objects

I prefer #4 mainly because I'm a fan of naming things what they are, especially data, and implementing some things regarding presentation or specific app behavior (like ordering) in code. Imagine copying the assets to a similar, but different app. The ordering might become totally irrelevant even if the images were useful.

#1 is easy, #3 is even easier, and #4 is a little bit of overhead and boilerplate.

uncle blog
Nov 18, 2012

Doctor w-rw-rw- posted:

3) Prefix your images, Foobar_1,Foobar_2,...,Foobar_10, and so on
Pro: Predictable
Con: Still have to keep track of the maximum number
Thanks! Went for this one. Wanted the icons to keep their descriptive names, but seems more effort than it's worth.


Is there an easy way to create a space (where the background is visible) between cells in a tableView? Saw a suggestion for switching to sections instead of rows, but that creates a heap of issues as I use their row number elsewhere.

Kallikrates
Jul 7, 2002
Pro Lurker

Doctor w-rw-rw- posted:

Anyone know when Xcode 8.3 is landing? Some coworkers will need it soon.

Little bird is telling me very soon. More evidence today's release looks very much like GM. We are prepping our app icon changing releases.

Data Graham
Dec 28, 2009

📈📊🍪😋



Branding / app strategy question.

Suppose one has an app which is tailored to a city-specific service (let's say, for example, a catalog of parks in New York). Suppose that you then make another version of the app for parks in San Francisco. And another for Chicago, London, etc.

The technically most elegant solution of course is to just have one app that does all the cities, and anyone can use it by customizing it for the city they're in. But from a branding standpoint it can be better to have "New York" or "Chicago" in the name/description of the app, so it's more specifically useful and more discoverable. I know this is a time-honored approach used by a lot of app authors, but it also smacks of stupid SEO tricks.

Does Apple frown on there being a million different apps all tailored to different cities? Or is that still cool with them?

Doh004
Apr 22, 2007

Mmmmm Donuts...

uncle blog posted:

Is there an easy way to create a space (where the background is visible) between cells in a tableView? Saw a suggestion for switching to sections instead of rows, but that creates a heap of issues as I use their row number elsewhere.

Make your UITableViewCell's background color clear and add empty views as "spacers". Quick and dirty.

Or if you want to be a cool kid and Do It Right, use a UICollectionView and use its built in item spacing.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Data Graham posted:

The technically most elegant solution of course is to just have one app that does all the cities, and anyone can use it by customizing it for the city they're in. But from a branding standpoint it can be better to have "New York" or "Chicago" in the name/description of the app, so it's more specifically useful and more discoverable. I know this is a time-honored approach used by a lot of app authors, but it also smacks of stupid SEO tricks.

Does Apple frown on there being a million different apps all tailored to different cities? Or is that still cool with them?

I hope that isn't a problem because that's basically what my company does (white labels apps for health care providers / fitness centers).

lord funk
Feb 16, 2004

Doh004 posted:

Or if you want to be a cool kid and Do It Right, use a UICollectionView and use its built in item spacing.

liberate tutemet ex inferis

Nah just make your cells transparent, with a height equal to cell + spacer. Then add subviews for your content.

Data Graham
Dec 28, 2009

📈📊🍪😋



Doh004 posted:

Make your UITableViewCell's background color clear and add empty views as "spacers". Quick and dirty.

What I did was this, except instead of "spacers" I made a secondary view inside the Content View to be the actual content view and hold all the content. Everything outside it is clear and the background shows through.

Doh004
Apr 22, 2007

Mmmmm Donuts...

lord funk posted:

liberate tutemet ex inferis

Love me some UICollectionViews. We're best buds.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
Cross-posting my adventures with UIDynamics from the Post your glitches thread.


The idea for a dumb easter egg:

https://zippy.gfycat.com/EasygoingJubilantBeaver.webm


What happens when you put the avatar in a container view without changing any code:

https://zippy.gfycat.com/EnchantedIncompatibleArabianhorse.webm


My favorite was an early lesson not to mix UIDynamics with translatesAutoresizingMaskIntoConstraints:

https://zippy.gfycat.com/InfamousNewBeauceron.webm

Glimm
Jul 27, 2005

Time is only gonna pass you by

Is it possible to apply for a WWDC ticket and give the ticket to someone who isn't named on the account? Basically my company's account has one of our business person's name on it but if we are lucky enough to get in we would obviously like one of our developers to go to the conference.

Kallikrates
Jul 7, 2002
Pro Lurker
Usually if you have the ability to do that your company has the contact info for someone at apple to facilitate that.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Unless they decide to crack down on it this year for some reason, showing up with a badge with someone else's name on it is not at all a problem. Apple doesn't really have a reason to care beyond wanting to avoid having people reselling them.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Ugh bitcode. Xcode 8.3 has made it grow from 16 MB to 70 MB for us.

Adbot
ADBOT LOVES YOU

brap
Aug 23, 2004

Grimey Drawer
How is go to definition/show documentation (alt+click) so INSANELY fragile for Swift in Xcode? The time I need to see a doc for a method is when I haven't provided a valid argument to it yet!

Apple's dev tools are so staggeringly, staggeringly bad in comparison to almost any other vendor's.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply