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
TheReverend
Jun 21, 2005

Anybody got a link to a VIP / CleanSwift article that is short and concise and not unnecessary verbose ?

Just a simple example or something?

Adbot
ADBOT LOVES YOU

Doc Block
Apr 15, 2003
Fun Shoe

Good Sphere posted:

Anyone know anything special I need to change when developing for devices that have a native color space of Display P3 instead of sRGB? It has nothing to do with my assets, but images I'm pulling through the camera rendered onto a MTKView and applying CIFilters to. It seems like devices with Display P3 a very unsaturated compared to ones using sRGB, and I need to figure out whatever needs to be changed to make them look more similar. I've only tested the iPhone XS that has Display P3 personally, and it may have to do with something else other than the color space, but have no clue if this is true and where to start off to understand why the camera's image is so much less saturated.

Something to do with color space conversions maybe?

Doc Block
Apr 15, 2003
Fun Shoe
Anybody know how to make Xcode display the GPU performance gauges when running a Metal app? Could've sworn it used to show GPU performance stats alongside CPU and Memory stats in the debug panel while your app was running.

It'll show them when I do a GPU Frame Capture, but right now I'm more interested in seeing the basic stuff while the app is running (FPS and GPU load/frametime) like Xcode used to do.

edit: mashing this button and changing to View Process by Queue then back to View Process by Thread made the GPU perf gauges show up



Doc Block fucked around with this message at 02:20 on Dec 1, 2018

lord funk
Feb 16, 2004

Doc Block posted:

Anybody know how to make Xcode display the GPU performance gauges when running a Metal app?

I've been working with Metal for 3 years, and all I know is that the GPU tools come and go like the weather.

toddy.
Jun 15, 2010

~she is my wife~

Boris Galerkin posted:

I'm currently using the IFTTT app on my iPhone with a webhook to trigger a rich notification to be sent to my phone (via the IFTTT app). It works but I'd like to be be able to add rich actions(?) to the notification, such as "remind me later" or "remind me tomorrow." For various reasons Reminders doesn't work for me/fit into my workflow here. So I had an idea to create a single purpose iOS app that will let me push notifications to it (also via a rest webhook set up on my own server) with those rich notification actions.

Can I do this with a free developer account and side loading the app? Or do I need a $99 developer account? Can I even send non-local push notifications to my iPhone without the app being on the App Store?

e: Looks like I'd need a $99 developer account to get access to remote push notifications.

Pushover might be an easy win over writing an app from scratch.

Good Sphere
Jun 16, 2018

Doc Block posted:

Something to do with color space conversions maybe?

The difference I'm seeing are images coming through the camera, where the iPhone Xs is much less saturated. That could possibly be it, but I don't know where to look. I don't see anywhere where I'm setting something to sRGB for instance. I see CGColorSpaceCreateDeviceRGB(), which there are no other choices. I see kCVPixelFormatType_32ARGB for my CVPixelBuffer. Maybe that's a problem? Not really sure.

AnimeIsTrash
Jun 30, 2018

So i'm looking to play around with some iOS development however the only problem is that I don't have any OSX devices. It looks like from looking around any post 2012 macbook will do. Is this still the case? I was looking at getting a 2014 (or 2015) macbook air from a friend who was looking to sell his.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

AnimeIsTrash posted:

So i'm looking to play around with some iOS development however the only problem is that I don't have any OSX devices. It looks like from looking around any post 2012 macbook will do. Is this still the case? I was looking at getting a 2014 (or 2015) macbook air from a friend who was looking to sell his.

The 2015 Air was a bit long in the tooth in 2015 (they were refreshed this year), but is still servicable. A 2015 MacBook Pro will have quite a bit more headroom.

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?
I still use a 2015 i7 MacBook Pro and it works great. So does my family 2012 i7 Mac mini.

If some component hadn’t died on it recently, my 2012 i7 MacBook Pro would also be reasonable.

Stringent
Dec 22, 2004


image text goes here
The only performance issue for anything made in the past five or so years is going to be RAM if you're running simulators.

Doh004
Apr 22, 2007

Mmmmm Donuts...
I was able to do some freelance on a new app last year on my 2012 MB air. 2014 or 2015 will be fine. The biggest annoyance is actually SSD space. 128 is woefully inadequate given the size of macOS, XCode and simulators.

lord funk
Feb 16, 2004

Oh man it's been a while since I've updated my apps. Anyone have any tips for a privacy policy? The only thing I'm 'collecting' is crash reports from Apple. I don't use Crashlytics anymore, or collect / retain any other data.

Anyone here use a legal document generating service?

edit: nvm, found some decent info

lord funk fucked around with this message at 21:19 on Dec 7, 2018

lord funk
Feb 16, 2004

It's too bad there's no way to check if the device is put to sleep. I have a MIDI app that has to be able to run in the background if it's being used with other audio apps, but it will run forever even after the device is put to sleep. Normally the user can tell if an app is doing this, because it continues to make sound. But my app doesn't, because it's a MIDI app.

Just got rejected for accessing a private API, which is understandable. The solution is to kill a bunch of people's battery life when they think they're putting their devices to sleep. :/

dc3k
Feb 18, 2003

what.

lord funk posted:

It's too bad there's no way to check if the device is put to sleep. I have a MIDI app that has to be able to run in the background if it's being used with other audio apps, but it will run forever even after the device is put to sleep. Normally the user can tell if an app is doing this, because it continues to make sound. But my app doesn't, because it's a MIDI app.

Just got rejected for accessing a private API, which is understandable. The solution is to kill a bunch of people's battery life when they think they're putting their devices to sleep. :/

Can you put something in the keychain that has the kSecAttrAccessibleWhenUnlocked flag, and try to access it periodically and shut down if it can't be accessed?

I dunno if that's a horrible idea or not. It might be :)

MISAKA
Dec 10, 2018
You dont need to mess around with the keychain, just use UIApplication.isProtectedDataAvailible. Obviously, tat doesnt work if the phone isnt passworded, but in that case, battery life is the least of user's problems.

lord funk
Feb 16, 2004

Nah I'm done caring about it. Just needed to vent.

Also need to vent that none of my apps successfully run Instruments >> Time Profiler. Hooray for Xcode v.perpetual beta!

Doctor w-rw-rw-
Jun 24, 2008
You could send a local notification reminder every so often notifying the user that it’s still running and allow a config option to disable it

lord funk
Feb 16, 2004

Doctor w-rw-rw- posted:

You could send a local notification reminder every so often notifying the user that it’s still running and allow a config option to disable it

Jesus christ no. iOS has enough performance-ending notifications already (it's a music app, after all).

A bassist friend of mine just posted that she was in the middle of an orchestra movement, reading off of her iPad score software, when an audience member sent her a picture through Air Drop. Turns out even when in Airplane mode and with Notifications off this is still possible.

Stringent
Dec 22, 2004


image text goes here

lord funk posted:

Jesus christ no. iOS has enough performance-ending notifications already (it's a music app, after all).

A bassist friend of mine just posted that she was in the middle of an orchestra movement, reading off of her iPad score software, when an audience member sent her a picture through Air Drop. Turns out even when in Airplane mode and with Notifications off this is still possible.

Lol, that's hilarious.

Dirk Pitt
Sep 14, 2007

haha yes, this feels good

Toilet Rascal

lord funk posted:

Jesus christ no. iOS has enough performance-ending notifications already (it's a music app, after all).

A bassist friend of mine just posted that she was in the middle of an orchestra movement, reading off of her iPad score software, when an audience member sent her a picture through Air Drop. Turns out even when in Airplane mode and with Notifications off this is still possible.

She should know to turn off Bluetooth :hurr:

That is really dumb tbh, and sucks a lot.

Doh004
Apr 22, 2007

Mmmmm Donuts...
To be fair, I'm always amazed at people who haven't turned off airdrop for anyone that isn't a contact.

lord funk
Feb 16, 2004

Anyone know why CustomStringConvertible + description wouldn't work? I still get a full list of every property, their properties, etc. when I try to print(self) in the debugger.

code:
class MetalView: MetalHitTestable, BSDraggable, Equatable, CustomStringConvertible {
    
    //===================================================================================
    //MARK: CustomDebugStringConvertible
    //===================================================================================
    
    var description: String {
        return "\(uniqueKey)"
    }
The description property never even calls :/

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Not sure if it’s relevant but the comment says debug string convertible but the implementation is for plain old string convertible.

lord funk
Feb 16, 2004

pokeyman posted:

Not sure if it’s relevant but the comment says debug string convertible but the implementation is for plain old string convertible.

Oh nope that was just me trying to troubleshoot. I tried both CustomStringConvertable and CustomDebugStringConvertable and neither did anything.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

lord funk posted:

Oh nope that was just me trying to troubleshoot. I tried both CustomStringConvertable and CustomDebugStringConvertable and neither did anything.

`p` in the debugger does not invoke any of that machinery, but `po` does (or at least it should).

lord funk
Feb 16, 2004

Simulated posted:

`p` in the debugger does not invoke any of that machinery, but `po` does (or at least it should).

Oh poo poo that'll do it. I stopped using 'po' a while ago with Swift because it was slow and buggy as hell. I switched to just using 'print'. Thanks.

Good Sphere
Jun 16, 2018

Looking to understand real time chroma keying "green screen" effects. Luckily Apple's docs has an example of chroma keying, but it's not really suitable to be used in real time.

After looking at the code for a bit, I noticed the first constant "size" defined in chomaKeyFilter(). I'm not sure what it does. I set it from 64 to 16, and I don't notice much visual difference, but the performance dramatically increased! Anyone have any guesses?

code:
	func chromaKeyFilter(fromHue: CGFloat, toHue: CGFloat) -> CIFilter?
	{
		// 1
		let size = 16//64
		var cubeRGB = [Float]()
		
		// 2
		for z in 0 ..< size {
			let blue = CGFloat(z) / CGFloat(size-1)
			for y in 0 ..< size {
				let green = CGFloat(y) / CGFloat(size-1)
				for x in 0 ..< size {
					let red = CGFloat(x) / CGFloat(size-1)
					
					// 3
					let hue = getHue(red: red, green: green, blue: blue)
					let alpha: CGFloat = (hue >= fromHue && hue <= toHue) ? 0: 1
					
					// 4
					cubeRGB.append(Float(red * alpha))
					cubeRGB.append(Float(green * alpha))
					cubeRGB.append(Float(blue * alpha))
					cubeRGB.append(Float(alpha))
				}
			}
		}
		
		let data = Data(buffer: UnsafeBufferPointer(start: &cubeRGB, count: cubeRGB.count))
		
		// 5
		let colorCubeFilter = CIFilter(name: "CIColorCube", parameters: ["inputCubeDimension": size, "inputCubeData": data])
		return colorCubeFilter
	}

Doc Block
Apr 15, 2003
Fun Shoe
It’s the size of the kernel. Making it smaller appears to lower the number of surrounding pixels that get sampled.

Good Sphere
Jun 16, 2018

Doc Block posted:

It’s the size of the kernel. Making it smaller appears to lower the number of surrounding pixels that get sampled.

It's interesting because it seems I can kind of circumvent that by expanding the from and to range. And I realized pretty late into playing around with it those ranges need to be in a 0.0 to 1.0 range, and not the actual radians below pi. One thing I can't seem to get right is affecting the red part of the spectrum without it racing by it if I'm scanning across the range. Seems to do that on the violet part of the spectrum a bit too.

TheReverend
Jun 21, 2005

UI tests.

Sometimes finds my elements?! Sometimes not. I say 90% of the time they are found for any single test.

Now do this with 20 tests and you can see why making this part of our CI flow pisses me off!

I'd really like the folks at Apple not make this suck so hard!

Any hot tips?

Stringent
Dec 22, 2004


image text goes here
Don't do UI tests.

TheReverend
Jun 21, 2005

Yeah I know right ?!

Problem is director guy has a mandate to make our releases be DevOppy and have no actual human beings required for testing. Just automation and unit tests .

It's a noble goal but goddamn we gotta figure something out.

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?
What are the failures that you’re running into?

If there are particular elements that aren’t showing up in the element hierarchy at the point your test is trying to interact with them, you can create a predicate expectation and then wait on that before actually querying that element.

Be sure to explicitly create an expectation and then wait on it, the implicit expectation stuff is risky to use in building a library of test infrastructure because implicit expectations just accumulate on creation, and you can only wait on any particular expectation once.

Also be sure to use a predicate for the expectation, rather than write a block or something; predicates will be more efficient because the testing infrastructure can optimize how they’re checked vs. running arbitrary code in your test that periodically tries to access state in your app.

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?

Stringent posted:

Don't do UI tests.

:wrong:

It’s important to test both your application’s logic itself and the way your users interact with it.

As an added bonus, creating UI tests will also help build out your application’s accessibility. Just using it via tests probably won’t result in perfect accessibility compared to what a VoiceOver or other assistive technology user will expect, but it’ll go a long way towards addressing their needs, and any changes you make to improve the experience for them will probably also improve your tests.

Oh, and the other thing to do is to create a library of app-specific abstractions to use in your tests, so your UI tests can be written at a very high level relative to your app. I.e. if your app needs to log in to a server, your library would have a concept of logging in that abstracts away the specific UI involved, so if you need to change the UI only that part of your tests needs to change. This is also a good place to put expectations that you need to wait on for e.g. UI transitions.

TheReverend
Jun 21, 2005

Yeah we use the expectations with generous timeout values and it works but only 90% of the time.

Mikey-San
Nov 3, 2005

I'm Edith Head!

eschaton posted:

What are the failures that you’re running into?

If there are particular elements that aren’t showing up in the element hierarchy at the point your test is trying to interact with them, you can create a predicate expectation and then wait on that before actually querying that element.

And if you just need to wait for an element to show up, -[XCUIElement waitForExistenceWithTimeout:] handles things for you.

Mikey-San fucked around with this message at 23:43 on Dec 21, 2018

Mikey-San
Nov 3, 2005

I'm Edith Head!

TheReverend posted:

Yeah we use the expectations with generous timeout values and it works but only 90% of the time.

Can you give a specific example? Without more detail, all we can do is speculate about common problems people encounter. (One or more of the issues may not be timeout-related at all.)

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do
Weird. I've done UI tests on a handful of projects now, and I've yet to run into failure rates of finding stuff anywhere near 90% :shrug:

I've also posted in here before about the strategy I prefer to follow when architecting UI Tests (notably, a screen-based approach); and I've found that spending some time up-front thinking about how you want to architect the UI tests to reduce duplication helps immensely in the long run in terms of getting test stability.

I do think there are good arguments to be had about how extensive UI Tests should be in a given app (that is, value vs. time-to-run), and on my current project we're setting up two different UI Test flows: one that just covers core functionality of the app and runs in CI, and another that covers a lot more ground in the app, to be run manually when it's time to do things like regression test (and to be fair, we're still hammering out how exactly we want to structure all this and cadence of things).

TheReverend
Jun 21, 2005

Yeah actually I've been using your ideas for screen based where possible. Problem is it's an old app and dependency injection wasn't something anyone cared about.

We're working on it though.

Problem is they want UI testing to be the sole testing framework for regression and release purposes. By the time we cover everything it'll take eons to tun!

I'll find some examples of where these tests seem to fail.

Adbot
ADBOT LOVES YOU

Doctor w-rw-rw-
Jun 24, 2008
So who wants to take bets that 2019 is year of the Swift desktop runtime (being included on device)? It seems to have been getting better at a pretty steady pace.

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