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

Suits are debating if they want a total rewrite, so maybe doable.

Adbot
ADBOT LOVES YOU

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?
After all, your codebase is so old, maybe it’s time for a rewrite…

;)

(And social network apps are “large.”)

Kallikrates
Jul 7, 2002
Pro Lurker

Good Sphere posted:

Yeah I was thinking the same thing, and I tried looking for it using the mdls command and exiftool to check for extra exif information. To rotate a video, I apply a transform.

I save my video using PHPhotoLibrary, so maybe it adds something extra about orientation? Can I share a video similar to what I did in my post above, except have PHPhotoLibrary make the asset? I tried doing something like that, but I don't know how if it's possible.

Last time I touched Photos, If remember correctly, exif stripping happened when trying to extract image data from the asset.

Dog on Fire
Oct 2, 2004

quote:

Various posts about method families, esp. the link https://clang.llvm.org/docs/AutomaticReferenceCounting.html#method-families

Sorry for the late reply, but thank you for the help, people! That was exactly the information I was looking for.

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

eschaton posted:

After all, your codebase is so old, maybe it’s time for a rewrite…

;)

(And social network apps are “large.”)

All I will say is if you find yourself exceeding the linker's size limits you shouldn't work around the problem, you should find the 7 different ORM implementations inside your app and remove 6 of them.

Doctor w-rw-rw-
Jun 24, 2008
Documentation @ https://developer.apple.com/documentation/swift/anyhashable/2432102
code:
let x = AnyHashable(Int(42))
let y = AnyHashable(UInt8(42))

print(x == y)
// Prints "false" because `Int` and `UInt8` are different types
Actual output
code:
true
🤔

TheReverend
Jun 21, 2005

Anyone recommend a good Swifty DI framework?

SaTaMaS
Apr 18, 2003
Is Autoresizing being deprecated? When I use it for simple layouts where I don't need to worry about clipping I get the warning "Auto Layout Localization: Views without any layout constraints may clip their content or overlap other views." Is there any way to remove that error without having to use constraints?

Good Sphere
Jun 16, 2018

Anyone have any clue as to why my UIPickerView isn't being masked? (The text appears outside of the mask)

I made sure the mask layer is in the correct position, by adding it to my view controller (the commented out line). However, it appears black, even though specified by the background color as red. Added to this, the fill rule of evenOdd, doesn't seem to be happening since I get the rectangle over my filterSelection, instead of the inverse. Finally, the filterSelection (the UIPickerView) outside of the maskLayer still appears, so the mask has no effect.

code:
   guard let BG = filterSelectionBG else { return }
    let maskLayer = CAShapeLayer()
    maskLayer.backgroundColor = UIColor.red.cgColor
    let path = CGMutablePath()
    path.addRect(filterSelection.bounds)
    path.addRect(BG.frame)

    maskLayer.path = path
    maskLayer.fillRule = .evenOdd
    //self.view.layer.addSublayer(maskLayer)
    filterSelection.layer.mask = maskLayer

duck monster
Dec 15, 2004

Does anyone know if its possible to get a stand-alone installer for the latest XCode? I've been trying for two days to install off the app-store but every time it ends up at 94.something percent and just sits there forever, leaving it impossible to actually run xcode without a reset of the computer. This is super frusturating, because I cant find any way to run the install manually and automatically don't work at all. And at least with an installer I can usually work out where and why its making GBS threads itself.

duck monster fucked around with this message at 09:16 on Mar 27, 2019

Froist
Jun 6, 2004

duck monster posted:

Does anyone know if its possible to get a stand-alone installer for the latest XCode?

Yep, https://developer.apple.com/download/more

Froist fucked around with this message at 08:51 on Mar 27, 2019

Doh004
Apr 22, 2007

Mmmmm Donuts...
I always just use The One True Stack Overflow Answer: https://stackoverflow.com/questions/10335747/how-to-download-xcode-dmg-or-xip-file

(Just make sure you're logged into your developer account first before clicking on the links)

duck monster
Dec 15, 2004

Doh004 posted:

I always just use The One True Stack Overflow Answer: https://stackoverflow.com/questions/10335747/how-to-download-xcode-dmg-or-xip-file

(Just make sure you're logged into your developer account first before clicking on the links)

Bookmarked!

Also fun fact. Something very hosed up is going on with IPv6 UDP in the latest IOS, the REUSE flag seems borked. Filed a bug report, but not sure what'll come of it. It may be by design (Something something sandboxing whatever)

Froist
Jun 6, 2004

duck monster posted:

Also fun fact. Something very hosed up is going on with IPv6 UDP in the latest IOS, the REUSE flag seems borked. Filed a bug report, but not sure what'll come of it. It may be by design (Something something sandboxing whatever)

You have my interest - in the last week my work’s latest update (which introduces UDP connections) has had issues with IPv6 UDP on some Android forks (obviously unrelated), but the iOS version hasn’t released yet because we’re stuck in rejection limbo.

Seems a good opportunity to figure out if we’ll have similar issues waiting for us when we manage to release on iOS. Have you got any more details/an OpenRadar link for what exactly is “very hosed”?

KidDynamite
Feb 11, 2005

Anyone have a good resource for learning SpriteKit? I'm trying to make some character grids and my positioning is all wonky.

Dominoes
Sep 20, 2007

Hey dudes, looking for advice. I have a webapp I'm trying to get on (locked down with Blackberry) iPads at work. It's an SPA built using React. If these were android tablets, I'd just load the folder up and put a shortcut on the homepage, but from what I've gathered, I need to make an `App` to make it work on iPad. Is this correct?

What approach would you recommend, given it's in a working/complete state in webapp form. I'm leaning React-Native from what I gather. The code change may be as simple as replacing DOM elements with React-Native ones, then install it via Expo. Is this right? Is there a simpler way?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
You can add a website to the home screen from Safari (tap Share, pick Add to Home Screen), and you can add some meta tags etc. so it looks less like running some website in Safari. I think people have started calling this a PWA for some reason, so that might be a useful search term.

Separately, you can use MDM to add non-removable home screen bookmarks.

If the above doesn’t get you close enough, then yeah your next step is to stick it in an app.

Dominoes
Sep 20, 2007

Would that work offline?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
It should, assuming it’s been opened at some point. Not sure how it does with an MDM-enforced bookmark that’s never been opened.

TheReverend
Jun 21, 2005

The Costco app is just a full screen webview, pretty much.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Yep that’s always an option. Especially if you don’t care about App Store distribution.

Dominoes
Sep 20, 2007

Thank y'all very much. So I drop in my folder (Contains an HTML file and a JS bundle) somewhere in the file system, then long-press the html file and send to homescreen (or equiv) ?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I think you’ll need to host it somewhere, then set up a web manifest for offline support. Then browse to the site in Safari and add to home screen. Doesn’t have to be publicly hosted I guess, could be somewhere on the local network.

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?

Dominoes posted:

So I drop in my folder (Contains an HTML file and a JS bundle) somewhere in the file system,

This isn’t a thing on iOS. Well, it is, under the hood, but you and your users don’t have direct access to it.

Your best bet was to have created an actual native application from the start instead of assuming some HTML and JavaScript was going to cut it.

You can put together a basic app that’s just a web view wrapping your HTML and CSS but it’s not going to be a great iOS-like user experience, any more than accessing it over HTTP would be.

Doctor w-rw-rw-
Jun 24, 2008
A webapp with react for an internal-use app? React Native is fine, or you can just embed it with a WKWebView. Since it's already built then I'd just stick with that and migrate to React Native when you're ready, if needed (and if ever).

Since it's internal use *only* (I assume) then the safari web page -> add to home screen is the most workable solution. Barring that, getting an enterprise cert for apps (costs money) and deploying a simple app that has the HTML/JS/CSS files in it and presents it with the aforementioned webview should work. If you want to push the app (or web page shortcut) to people's devices then you can use MDM, but that assumes your devices are online.

If the devices can't ever go online then...that's weird, because how are you going to update the iPads? If it's for security reasons then not updating the iPads is eventually going to render them less-than-secure.

Technically you could probably also make an app that serves the page up over a webserver locally but all of the above solutions are better than that.

Ignore the advice to build native from the start. Internal apps tend not to need a great iOS-like user experience, you can get well past the threshold of "good enough" for a lot of apps (even if you do need a good native API to build the best apps)

Dominoes
Sep 20, 2007

Awesome, thank you. Does the web page need to be online to work with WebView? It has sensitive info I'm handling without logins by keeping things local. Would this drive a react-native app vice WebView? I'm also curious how the blackberry layer will interfere. The devices go online to update, but not when being used.

Dominoes fucked around with this message at 12:37 on Apr 11, 2019

Doctor w-rw-rw-
Jun 24, 2008

Dominoes posted:

Awesome, thank you. Does the web page need to be online to work with WebView? It has sensitive info I'm handling without logins by keeping things local. Would this drive a react-native app vice WebView? I'm also curious how the blackberry layer will interfere. The devices go online to update, but not when being used.

- No need to be online but make sure to test.
- React Native uses native UI. React.js (traditional React) that uses HTML is not React Native.
- Don't know what a blackberry layer is.

Doh004
Apr 22, 2007

Mmmmm Donuts...
You're probably going to run into a ton of extra work to port your existing React app to act like a PWA. What sort of SPA is your application? Is it a bunch of HTML, CSS and JS that are precompiled or are you relying on a server to provide some level of dynamicism(spelling?) for you?

The only experience I have with this is using Gatsby which is a static site generator with great plugins to make your site easily available offline, but you should check out the modern web dev thread for more of that.

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do
Is anyone else having an issue with TestFlight? I've tried turning off the notifications for new builds in TestFlight, but I'm still getting emails and notifications. Is there some additional step I've done before that I'm forgetting this time around?

Dominoes
Sep 20, 2007

Doctor w-rw-rw- posted:

- No need to be online but make sure to test.
- React Native uses native UI. React.js (traditional React) that uses HTML is not React Native.
- Don't know what a blackberry layer is.
Thank you! It seems like converting to Native might be mainly admin things like swapping out <div> with <View>, <input> with <TextInput> etc. We have a Blackberry layer running on top of iOS, for security, or something. Apple was the wrong choice for these since it's not suitable for heavily customized operations. But it's done.

Doh004 posted:

You're probably going to run into a ton of extra work to port your existing React app to act like a PWA. What sort of SPA is your application? Is it a bunch of HTML, CSS and JS that are precompiled or are you relying on a server to provide some level of dynamicism(spelling?) for you?

The only experience I have with this is using Gatsby which is a static site generator with great plugins to make your site easily available offline, but you should check out the modern web dev thread for more of that.
No server interaction. Just HTML/CSS/JS precompiled.Thanks for the rec!

an actual cat irl
Aug 29, 2004

Hi guys - i'm building an iOS app in which I need to dynamically build the UI, based on the data set currently being viewed, and just wanted to solicit some thoughts on how best to approach this, before wasting a bunch of time doing it wrong.



Specifically, the application pulls a bunch of metrics from an API, and then renders the data into charts in UIViews. As you can see from the screenshot above, there's a small amount of summary data at the top of the view, and then a number of charts - currently the UIViews containing the charts are fixed but, as I extend the app, the number of metric sets can vary, so I need to app to programmatically add the chart UIViews as it iterates through the data.

I'm pretty new to Swift, so have been googling around and reading tutorials etc, but I'm having trouble finding a definitive answer on how best to do something like this. My initial thoughts were around building a chartView UIView class + xib, and then adding it as a child view multiple times as I need it, but I'm not very confident that this is the right approach. Should I be trying to shoe-horn this into a UITableView or something? Any advice on how to proceed would be appreciated.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
If there’s less than three screenfuls of charts, I’d toss them into a stack view embedded within a scroll view. More than that, time for a collection view or a table view. If they’re all the same height it’ll be straightforward to mush them into a collection view or table view.

Either way you’ve got the right idea: make a view and a xib, then either register that xib with the collection view or table view, or just instantiate your view from the xib each time you need a new one and add to the stack view’s arranged subviews.

an actual cat irl
Aug 29, 2004

pokeyman posted:

If there’s less than three screenfuls of charts, I’d toss them into a stack view embedded within a scroll view. More than that, time for a collection view or a table view. If they’re all the same height it’ll be straightforward to mush them into a collection view or table view.

Either way you’ve got the right idea: make a view and a xib, then either register that xib with the collection view or table view, or just instantiate your view from the xib each time you need a new one and add to the stack view’s arranged subviews.

Perfect - thank you! I think that a collection or table view is probably the most appropriate way to go, so i'll look into that.

Workaday Wizard
Oct 23, 2009

by Pragmatica
I am so loving sick of Elsagate videos showing up in kids’ youtube :mad:

I want a way to block these videos as they come (basically any video link with some keywords in the video title gets deleted). Content blockers is useless for this unless I scrape youtube before hand and poo poo and even then the blocking action it has are pathetic. CSS blocking will not work (unless youtube gives each video link a specific immutable id).

How can intercept traffic to webkit? I am fine with making my own app. Can I run a webkit view with a specific proxy? All answers point to no. But if anyone knows anything please let me know.

fankey
Aug 31, 2001

I'm attempting to use NSScanner to parse CSS style colors - rgb(), rgba(), red, blue, #RRGGBB, etc. I sorta have something working to deal with rgb/rgba
code:
#import <Foundation/Foundation.h>

void scan(NSString* str)
{
  NSLog(@"parsing '%@'", str);
  NSString *funcName = nil;
  NSCharacterSet* parenSet = [NSCharacterSet characterSetWithCharactersInString:@"("];
  NSScanner* theScanner = [NSScanner scannerWithString:str];

  if([theScanner scanUpToCharactersFromSet:parenSet intoString:&funcName] &&
     [theScanner scanString:@"(" intoString:NULL])
  {
    if( [funcName isEqualToString:@"rgb"] || [funcName isEqualToString:@"rgba"])
    {
      int r,g,b;
      if([theScanner scanInt:&r] &&
         [theScanner scanString:@"," intoString:NULL] &&
         [theScanner scanInt:&g] &&
         [theScanner scanString:@"," intoString:NULL] &&
         [theScanner scanInt:&b])
      {
        if( [funcName isEqualToString:@"rgba"])
        {
          float a;
          if([theScanner scanString:@"," intoString:NULL] &&
             [theScanner scanFloat:&a])
          {
            NSLog(@"  GOT COLOR R %i G %i B %i A %f", r, g, b, a);
            return; // a UIColor at some point
          }
        }
        else
        {
          NSLog(@"  GOT COLOR R %i G %i B %i", r, g, b);
          return; // a UIColor at some point
        }
      }
    }
  }
  NSLog(@"  PARSE FAILED!");
}

int main(int argc, const char * argv[]) {
  @autoreleasepool
  {
    scan(@"rgb(12, 33, 12)");
    scan(@"rgba(12, 33, 12)");
    scan(@"rgba(12, 33, 12, .3)");
    scan(@"rgb( foo, 33, 12)");
    scan(@"rbg( foo, 33, 12)");
    scan(@"butt( 12, 33, 12)");
    scan(@"rgb 12, 33, 12)");
  }
  return 0;
}
prints
code:
2019-04-19 10:59:07.581163-0600 scannertest[12217:502752] parsing 'rgb(12, 33, 12)'
2019-04-19 10:59:07.582016-0600 scannertest[12217:502752]   GOT COLOR R 12 G 33 B 12
2019-04-19 10:59:07.582302-0600 scannertest[12217:502752] parsing 'rgba(12, 33, 12)'
2019-04-19 10:59:07.582355-0600 scannertest[12217:502752]   PARSE FAILED!
2019-04-19 10:59:07.582378-0600 scannertest[12217:502752] parsing 'rgba(12, 33, 12, .3)'
2019-04-19 10:59:07.582414-0600 scannertest[12217:502752]   GOT COLOR R 12 G 33 B 12 A 0.300000
2019-04-19 10:59:07.582443-0600 scannertest[12217:502752] parsing 'rgb( foo, 33, 12)'
2019-04-19 10:59:07.582475-0600 scannertest[12217:502752]   PARSE FAILED!
2019-04-19 10:59:07.582495-0600 scannertest[12217:502752] parsing 'rbg( foo, 33, 12)'
2019-04-19 10:59:07.582520-0600 scannertest[12217:502752]   PARSE FAILED!
2019-04-19 10:59:07.582540-0600 scannertest[12217:502752] parsing 'butt( 12, 33, 12)'
2019-04-19 10:59:07.582564-0600 scannertest[12217:502752]   PARSE FAILED!
2019-04-19 10:59:07.582584-0600 scannertest[12217:502752] parsing 'rgb 12, 33, 12)'
2019-04-19 10:59:07.582607-0600 scannertest[12217:502752]   PARSE FAILED!
This doesn't even cover all the function cases ( it breaks if there is a space between the function name and the ( which I think is valid in CSS. I'm not sure if there is better, more robust way to this? It's also not clear to me if it's possible to use it to deal with color functions, color strings as well as # hex definitions.

Doctor w-rw-rw-
Jun 24, 2008
indexOf rgba/indexOf rob followed by replace white lspace with nothing and split from index after ( on comma, assert the last char is ).

If that fails check for length =3,4,6,8 and that the character lowercases are in range. If 3 or 4 then double up the characters and get the number from that otherwise just get the number for it

Normalize to 0..1 and create your color from those components

fankey
Aug 31, 2001

Doctor w-rw-rw- posted:

indexOf rgba/indexOf rob followed by replace white lspace with nothing and split from index after ( on comma, assert the last char is ).

If that fails check for length =3,4,6,8 and that the character lowercases are in range. If 3 or 4 then double up the characters and get the number from that otherwise just get the number for it

Normalize to 0..1 and create your color from those components

Thanks. That's pretty much where I ended up - using NSScanner for the function parsing since it's pretty easy to get the arguments but then fall back and split the string apart manually if it's hex.

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:

This doesn't even cover all the function cases ( it breaks if there is a space between the function name and the ( which I think is valid in CSS. I'm not sure if there is better, more robust way to this? It's also not clear to me if it's possible to use it to deal with color functions, color strings as well as # hex definitions.

Just write a recursive-descent parser. They’re very easy: Describe the grammar you want to accept, then translate the productions in the grammar into function calls. Chances are you’ll need a max of one character of lookahead.

The thing I always find tricky about parsers is that I wind up forgetting about whitespace. So if your grammar accepts “rgb( 1, \t3, \n5);” you might write down the rule as

functionColor = functionName leftParen number (comma number)* rightParen semicolon.

but you really need to implement it as

functionColor = functionName whitespace* leftParen whitespace* number (whitespace* comma number)* whitespace rightParen whitespace* semicolon.

and so on.

This is one reason why people like to separate lexical analysis (breaking into tokens) from parsing (assigning meaning to tokens). You don’t actually have to do so, though, for example if whitespace and comments are universally-valid in your grammar you can just incorporate them into a “seekToNextToken” function or whatever.

Doctor w-rw-rw-
Jun 24, 2008
I don't doubt that that approach is super fast, and nice for compilers, but it sounds like overkill for a typical iOS app (assuming the developer is not already familiar with writing recursive descent parsers)

Adbot
ADBOT LOVES YOU

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

Doctor w-rw-rw- posted:

I don't doubt that that approach is super fast, and nice for compilers, but it sounds like overkill for a typical iOS app (assuming the developer is not already familiar with writing recursive descent parsers)

Every time I thought this I ended up being sorry I didn’t write a real parser to begin with.

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