|
I mean, this is ridiculous. Last time I noticed the size was when it pushed passed 10GB. Suddenly it's 3x bigger? It's half of my entire Applications directory size. But, you know, we should all be reducing our little mobile app sizes.
|
# ? May 4, 2021 13:32 |
|
|
# ? May 15, 2024 06:58 |
|
It's been gradually creeping up over time, and then Xcode 12 doubled the size of it. I assume it's because it's now all x86_64/arm64 fat binaries with no option to only install the architecture you're actually using.
|
# ? May 4, 2021 16:02 |
|
my 12.4 is only 15G on the M1, but I installed it with xcode-install, maybe it's different
|
# ? May 4, 2021 17:23 |
|
Vesi posted:my 12.4 is only 15G on the M1, but I installed it with xcode-install, maybe it's different I think the size reporting is a bit fucky with APFS.
|
# ? May 4, 2021 18:32 |
|
I'm trying to get Core Data working with SwiftUI's DocumentGroup, but it's not at all clear to me how that's supposed to hook up. It looks like ReferenceFileDocument expects to work on FileWrappers, while NSPersistantContainer only deals with URLs. I'm also a little confused about the Snapshot typealias ReferenceFileDocument needs. Strangely, I haven't found any tutorials that deal with this, does anyone here have any insight on this?
|
# ? May 6, 2021 05:59 |
|
Now you don’t have to wonder why the Core Data checkbox is dimmed out when you select SwiftUI for your app lifecycle in the Document App template.
|
# ? May 10, 2021 04:09 |
|
I've got two SKShapeNode's, a rotated rectangle and a circle, and I'm trying to check of they intersect or not. I definitely can't use frame.intersects because frame is the smallest containing unrotated refrangle. Any hot tips on how to approach this?
|
# ? May 10, 2021 10:59 |
|
Maybe something like this You’ll have to work out the vertices of your rectangle and transform them based on its rotation, but that’s pretty easy, especially in 2D (I believe Core Graphics has functions for translating and rotating 2D points that you could use). You could also bring in SpriteKit’s physics engine, but that’s kind of overkill for such a simple case, especially if all you want is to know if two shapes overlap and don’t need all the bouncy physics results. Doc Block fucked around with this message at 15:54 on May 10, 2021 |
# ? May 10, 2021 15:50 |
|
Doc Block posted:Maybe something like this Thanks for your thoughts! I ended up moving the other parts of the game over to use the physics engine and it already feels like the right approach. So far I'm hoping that keeping as much of my colliders circles as possible will keep performance good. Anyway so far this feels like the way to go
|
# ? May 11, 2021 07:46 |
|
I’ve been playing with a little toy SwiftUI project and I’ve been a bit surprised that random updates to the OS or XCode (not sure which) have introduced new compilation errors. Is that typical? Am I doing something wrong? For instance, I think I had a VStack that only had one child, because I had commented out the other, and now that is a compilation error.
|
# ? May 12, 2021 17:33 |
|
smackfu posted:I’ve been playing with a little toy SwiftUI project and I’ve been a bit surprised that random updates to the OS or XCode (not sure which) have introduced new compilation errors. Is that typical? Am I doing something wrong? I don't think they've made any major changes to SwiftUI in Xcode 12.5 and this definitely isn't the actual error. SwiftUI has wonky errors sometimes that are caused by statements earlier in the View struct.
|
# ? May 14, 2021 04:12 |
|
SwiftUI is a system framework, so Xcode won’t change the API. (An updated SDK included within Xcode can though, since a new OS can include API improvements.) On the other hand, Xcode can include a new compiler that can enable improvements to how the API is called.
|
# ? May 14, 2021 04:48 |
|
awesomeolion posted:Thanks for your thoughts! I ended up moving the other parts of the game over to use the physics engine and it already feels like the right approach. So far I'm hoping that keeping as much of my colliders circles as possible will keep performance good. Anyway so far this feels like the way to go That's probably the best approach anyway. Detecting the intersection of even simple shapes can have a surprising number or edge cases, let alone arbitrary polygons. The "cheap" method is to rasterize and check pixels which is shockingly fast on modern hardware. Using a physics engine is both more general and relies on someone else to have solved all the tricky edge cases with good performance.
|
# ? May 15, 2021 22:52 |
|
In Swift is there a way to say "this var should be the same type as this other var"? In typescript we use typeof, so for example:TypeScript code:
|
# ? May 19, 2021 15:38 |
|
I'm not aware of a way. Closest I can think of is a typealias. Though I did learn something about TypeScript today so thanks!
|
# ? May 19, 2021 16:07 |
|
Dang ok, thanks! Typescript is really powerful with that kind of stuff, you can use ReturnType<typeof someFunc> to get the return type, or use Pick<> or Omit<> to grab other types: TypeScript code:
|
# ? May 19, 2021 16:14 |
|
Are you just trying to abbreviate things, or are you trying to express some important generic relationship between the types of operations?
|
# ? May 19, 2021 17:01 |
|
I have a viewcontroller that's getting some data coming from another viewcontroller that gets it from a model. If I can say the data is of that type then if I change the model later I don't have to change anything else.
|
# ? May 19, 2021 18:01 |
|
Okay. Sounds like a good use for a typealias, then.
|
# ? May 19, 2021 21:10 |
|
I've found myself in the rather novel (for me at least) position of needing a tree in an app I'm working on. Not to get too far into the weeds about it, but I've got a picker view with seperate year, month and day components and for any given year I only want months with content to show up, and for any given month days, etc. Is there anything built in with Swift or Foundation that I should be looking at instead of rolling my own? I've googled a bit and everything comes up with ppl rolling their own, but I don't know if that's just because ppl mostly search for this for interviews or what.
|
# ? May 21, 2021 09:16 |
|
There isn't really an "etc." there, right? It's just a three-level tree of years/months/days? I wouldn't over-think this; the complication of building your own general tree data structure instead of just having, like, [Int: [[Content]]] doesn't seem worthwhile.
|
# ? May 21, 2021 19:29 |
|
etc was potentially timestamps, but that's still just an if. point taken though, i'll just nest dictionaries for the time being, thanks.
|
# ? May 22, 2021 00:03 |
|
So I'm presenting a VC over another using the present method. What's the common pattern regarding dismissing it. Is there an X in corner, the horizontal bar on the top to be dragged down? And is it something built in like an accessoryItem I can easily put in? Edit: This is Swift, and UIKit, with all views made programatically.
|
# ? May 26, 2021 13:48 |
|
uncle blog posted:So I'm presenting a VC over another using the present method. What's the common pattern regarding dismissing it. Is there an X in corner, the horizontal bar on the top to be dragged down? And is it something built in like an accessoryItem I can easily put in? The simplest/most native way would be to nest the view controller in a UINavigationController to present, and add a Done/Cancel button as a navigation item - which then calls to a function in the ViewController to call self.dismiss(). Since iOS 13 you also get swipe-to-dismiss for free. You can set isModalInPresentation = true on the view controller to disable this.
|
# ? May 26, 2021 13:55 |
|
Froist posted:The simplest/most native way would be to nest the view controller in a UINavigationController to present, and add a Done/Cancel button as a navigation item - which then calls to a function in the ViewController to call self.dismiss(). Just be aware that you may get some odd behavior with the free swipe-to-dismiss. At one point at least, if you slightly swiped down but not enough to close it, or dragged it down and then back up, viewDidAppear() would be called again. If you aren’t expecting it to be called more than once, you may get problems. I’m trying to fill an array as fast as I can to ultimately feed into a CGContext (right now just to generate a noise image. This is mostly for my own edification and entertainment). For some reason I can’t get close to the numbers quote me in this SO post: https://stackoverflow.com/questions/45045811/swift-array-accessors-5-times-slower-than-native-arrays-which-are-the-recommen I know it’s SO, but even copy and pasting all the various sample code given me results that are slower by about a factor of 5-10, including the examples with unsafe mutable pointers. This is into XCode itself, not a playground, and running on a 12 pro max and a 16inch Intel MacBook Pro, much newer than the 2017 date of the SO post. I’m wondering if I am running into an optimization level issue. I thought I set the optimization level to fastest for both debug and release but maybe I’m not doing something correct. Edit: turns out it was an optimization issue. I was setting Apple Clang - Code Generation - Optimization Level instead of Swift Compiler - Code Generation - Optimization Level. Not sure how they are different yet but changing the Clang level doesn’t seem to do much for my purposes. Edit 2: I believe Clang is used as the front end for Obj-C (and I assume C, C++, etc, hence “C Language”) while Swift uses Swiftc as the front end before both are then fed into LLVM. Pulcinella fucked around with this message at 18:52 on May 26, 2021 |
# ? May 26, 2021 18:16 |
|
You should always expect viewDidAppear to get called more than once. It's a common mistake to start tasks in viewWill/DidAppear that should either go in viewDidLoad (which is actually called at most once unless you're doing something really odd) or should include checking that you haven't already started the task. Another way this comes up is cancelling an interactive pop gesture on a navigation controller.
|
# ? May 26, 2021 18:52 |
|
While we're on the subject, don't put view creation in viewDidLoad, because the view is almost definitely not its actual size yet, which sucks for layout. That leaves viewWillAppear, which calls multiple times, but you can put an 'if view == nil { ... }' check in there for that.
|
# ? May 27, 2021 04:13 |
|
lord funk posted:While we're on the subject, don't put view creation in viewDidLoad, because the view is almost definitely not its actual size yet, which sucks for layout. That leaves viewWillAppear, which calls multiple times, but you can put an 'if view == nil { ... }' check in there for that. I usually set it up in loadView and let the constraints handle sizing
|
# ? May 27, 2021 16:44 |
|
I always put view creation in viewDidLoad and it always works for me, using AutoLayout.
|
# ? May 27, 2021 19:02 |
|
I think viewDidLoad is fine too, though you might be replacing the root view sometimes in which case loadView makes more sense because you've got to set the root there anyway If I've got to muck with layout after getting size information (adjusting constraint constants) I do it in viewDidLayoutSubviews, just be careful not to create a layout cycle.
|
# ? May 27, 2021 19:16 |
|
So I'm trying to make a layout programatically, but getting tripped up on how to set constraints and position things. Is there a good resource/overview for all the different terms and what rules apply in the view hierarchy?
|
# ? May 28, 2021 15:16 |
|
One thing that made AutoLayout a lot better to me is layout anchors and Use Your Loaf has a really good post about them: https://useyourloaf.com/blog/pain-free-constraints-with-layout-anchors/ I haven't read through Apple's docs here in awhile but this is probably good too, though you may have already seen it: https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/AutolayoutPG/index.html Anything specific causing you issues?
|
# ? May 28, 2021 15:24 |
|
uncle blog posted:So I'm trying to make a layout programatically, but getting tripped up on how to set constraints and position things. Is there a good resource/overview for all the different terms and what rules apply in the view hierarchy? I don't know if it's the best tool for the job but I use snapkit and its api is a lot nicer than the built in one.
|
# ? May 29, 2021 01:17 |
|
I use built-in layout anchors plus a couple helper methods for things like "add subview and constrain to [edges]". But I'm maybe unhelpfully allergic to dependencies. Also, the aforelinked Use Your Loaf has an entire book on Auto Layout, it's pretty good. If that's out of your budget, read all their blog posts
|
# ? May 29, 2021 02:29 |
|
i've got a snippet made for this patterncode:
i don't know where i picked this up and it may be a dumb way of doing things, but it works for me.
|
# ? May 29, 2021 02:44 |
|
Has anyone interviewed at Apple for iOS positions? Have an all day web interview to schedule and trying to figure out how much time to give myself and what to focus on for studying. I’m definitely weak at CoreData so that’s one place I will need to tighten up.
|
# ? May 29, 2021 16:04 |
|
KidDynamite posted:Has anyone interviewed at Apple for iOS positions? there will be an entire session solely dedicated to concurrency/multithreading. source: have bombed the multithreading interview. twice.
|
# ? May 29, 2021 16:40 |
|
Glimm posted:Anything specific causing you issues? Yeah, I get a: code:
This is the code: code:
vvv Thanks! That simple, huh. uncle blog fucked around with this message at 11:14 on May 31, 2021 |
# ? May 31, 2021 10:47 |
|
you gotta add the subviews before you activate the constraints
|
# ? May 31, 2021 10:58 |
|
|
# ? May 15, 2024 06:58 |
|
Fate Accomplice posted:there will be an entire session solely dedicated to concurrency/multithreading. Well poo poo. That’s def an area I need more experience with. Can you to point at any resources you think would have made you ace the section?
|
# ? Jun 1, 2021 05:00 |