|
Glimm posted:Static UITableViews? Maybe that's possible with xibs now. SaTaMaS posted:If you needed a customized UINavigationItem Fair points. I've never needed to use static TableViews and do nav stuff programmatically.
|
# ? Jun 20, 2020 17:42 |
|
|
# ? Jun 10, 2024 10:33 |
|
Ours has been entirely storyboard-based, don't think we have any .xibs in the repo. Each screen has it's own viewController and we use segues to go deeper into the UI flow. I don't know what the new one will use to handle any logic since swiftUI doesn't use viewControllers.
|
# ? Jun 20, 2020 17:57 |
|
It sure is going to be awesome when junior developers start showing up who know SwiftUI + Combine but don't know the first thing about ViewControllers, Core Animation, or how to structure non-SwiftUI apps...
|
# ? Jun 20, 2020 21:19 |
|
I don't think I've ever started a static table view that ended that way. Soon enough I want to do any sort of customization whatsoever, like hide a row sometimes, and it gets painful quick. See also: not embedding any remotely sizeable view in a scroll view. Add a label, or "oh right small phones", and it's time to redo all your constraints but in a scroll view this time!
|
# ? Jun 20, 2020 21:30 |
|
Still pretty confused and intimidated by scroll views. Is there any good resource that'll finally make them click? and are the new frame and content layout guides the way to go? Seen a few different resources that mention different ways to set them up
|
# ? Jun 21, 2020 01:57 |
|
Start with these WWDC videos (don't mind that they're a few years old): https://developer.apple.com/videos/play/wwdc2011/104/ https://developer.apple.com/videos/play/wwdc2012/223/ https://developer.apple.com/videos/play/wwdc2013/217/ There was also one in 2014 but the video seems to have been disappeared? https://asciiwwdc.com/2014/sessions/235 And then yep, if you're using auto layout then the newish content guides are great. https://useyourloaf.com/blog/easier-scrolling-with-layout-guides/ is a good overview.
|
# ? Jun 21, 2020 04:06 |
|
Pulcinella posted:I also found this* https://developer.apple.com/forums/thread/134001?answerId=423820022#423820022 I can confirm that this is the case. It works when building for a physical device, just not the simulator.
|
# ? Jun 22, 2020 02:00 |
|
SaTaMaS posted:It must be wonderful to not have to worry about capricious UX designers oh my god please never let ux people touch xibs/storyboards
|
# ? Jun 22, 2020 08:48 |
|
SwiftUI is getting grids and stacks thank gently caress. I'm hype y'all. https://developer.apple.com/documentation/swiftui/view-layout-and-presentation
|
# ? Jun 22, 2020 21:13 |
|
KidDynamite posted:SwiftUI is getting grids and stacks thank gently caress. I'm hype y'all. Still no backport I really didn’t expect one, but drat it is frustrating.
|
# ? Jun 22, 2020 23:39 |
|
What are good/important/useful in daily programming life things I should know about NSRunLoop / CFRunLoop, and does anyone have good sources on where to learn such things?
Fate Accomplice fucked around with this message at 02:09 on Jun 23, 2020 |
# ? Jun 23, 2020 01:32 |
|
Depends on the layer where most of your work takes place. Most developers shouldn’t have to care about more than processing an event involving a single turn of the run loop. Since I’ve implemented daemons and servers and stuff, I’ve had to care more; there I’ve mostly needed to know: 1. The main thread’s event processing autorelease pool is drained when the run loop is turned. 2. Asking for a run loop on a thread that doesn’t have one will create one. So don’t do it in something executed via dispatch. 3. A CFRunLoop underlies an NSRunLoop, in lower-level code you may need to interact with the underlying CFRunLoop. 4. If you’re implementing your own event processing, you can use a run loop source to put it together. Be sure to have some way to stop the run loop from outside, e.g. a -terminate method on your equivalent to NSApp. There’s also subtleties around processing blocks submitted to the main queue and on the main run loop; for the stuff I work on we have an abstraction that means I don’t have to worry about the distinction, so I don’t remember what it is offhand.
|
# ? Jun 23, 2020 03:06 |
|
Oh yeah, if you’re given a choice between dispatch- and runloop-based API in new code, use the dispatch-based API. If you’re creating API, prefer dispatch-based API.
|
# ? Jun 23, 2020 03:08 |
|
pokeyman posted:Start with these WWDC videos (don't mind that they're a few years old): Thanks! I'll check them out when I get some time
|
# ? Jun 23, 2020 16:51 |
|
thanks for this, reading through it helped a lot.
|
# ? Jun 23, 2020 20:12 |
|
Is there a discord where goon mobile developers hang out? I love following what folks on the forums are working on and would be really sad to see this community disappear, though it is pretty quiet these days.
|
# ? Jun 25, 2020 14:35 |
|
I joined the CoC and YOSPOS discords, mostly as a backup plan and to find out if people move to some other forum en mass.
|
# ? Jun 25, 2020 15:11 |
|
pokeyman posted:I joined the CoC and YOSPOS discords, mostly as a backup plan and to find out if people move to some other forum en mass. Nice, I've just joined those as well
|
# ? Jun 25, 2020 15:50 |
|
I found the YOSPOS one here but can’t find the CoC one? I don’t post here that often but I’ve lurked this thread daily for years, will be a shame if all this gets burned down
|
# ? Jun 25, 2020 19:03 |
|
pokeyman posted:There was also one in 2014 but the video seems to have been disappeared? https://asciiwwdc.com/2014/sessions/235 For some reason a lot of the 2014 WWDC videos were taken down earlier this year. They should still be downloadable from the server if you can find a link.
|
# ? Jun 25, 2020 19:14 |
|
Froist posted:I found the YOSPOS one here but can’t find the CoC one? I don’t post here that often but I’ve lurked this thread daily for years, will be a shame if all this gets burned down I found Goon Discord Network in a GBS post. It has a link to the CoC Discord (https://discord.gg/JFwAarN).
|
# ? Jun 25, 2020 22:06 |
|
ketchup vs catsup posted:thanks for this, reading through it helped a lot. Run loop sources use the info field to identify themselves so if you don’t fill it out with a unique value all but one of your sources will be ignored and not added to the run loop. Use of run loop modes can allow re-entrant processing which is a blessing and a curse. A blessing because sometimes you can’t control dependencies and it lets you avoid deadlocks, especially across processes. A curse because seriously WHAT THE gently caress. As eschaton says don’t mix run loops and dispatch. You’ll be sorry. But you can submit blocks to a run loop you own - or any work really. Create a run loop signaling source you add to the loop, enqueue whatever work you have for the loop, signal the source, then wake the loop (all from some other thread or dispatch queue).
|
# ? Jun 26, 2020 05:27 |
|
I’m completely new to iOS development and have a simple app I want to try to make. In 2020, is starting with SwiftUI my best bet? I’ll be honest, it’s a little confusing figuring out the differences between AppKIt, Uikit, Catalyst and SwiftUI, but I think I’m starting to get it.
|
# ? Jun 28, 2020 03:16 |
|
frogbs posted:I’m completely new to iOS development and have a simple app I want to try to make. In 2020, is starting with SwiftUI my best bet? I’ll be honest, it’s a little confusing figuring out the differences between AppKIt, Uikit, Catalyst and SwiftUI, but I think I’m starting to get it. Yes I would start with SwiftUI.
|
# ? Jun 28, 2020 03:23 |
|
Simulated posted:Yes I would start with SwiftUI. For iOS. Ignore app kit. SwiftUI is the future but if this interests you as a career at all I'd say go with UIKit because almost every codebase will be UIKit.
|
# ? Jun 28, 2020 04:48 |
|
frogbs posted:I’m completely new to iOS development and have a simple app I want to try to make. In 2020, is starting with SwiftUI my best bet? I’ll be honest, it’s a little confusing figuring out the differences between AppKIt, Uikit, Catalyst and SwiftUI, but I think I’m starting to get it. AppKit: The previous, long running way of making native Mac apps. Not deprecated or anything (at least not yet), but it’s probably not a good use of your time trying to learn it. UIKit: The previous, long running way of making native iOS apps. Still going strong and Apple continues to develop it, but it’s not the latest UI framework. Catalyst: A way of running UIKit apps on the Mac. (Basically running an iPad app on the Mac). Nice if you already have an iPad app that you also want release for the Mac. If you are starting from scratch though catalyst was obsoleted by SwiftUI pretty much as soon as it was released. SwiftUI: Apple’s latest UI framework that can be used to write iPhone, iPad, Mac, Watch, and tvOS apps. Still somewhat in it’s early days but it’s where the future is. Definitely start with it if you are just learning and want to make a simple app. Just know that most iOS apps are still UIKit apps.
|
# ? Jun 28, 2020 05:04 |
|
I had an annoying timewaster where I didn't know why stuff wrapped in AnyView wouldn't show up. Like this would compile but not have anything visible:code:
code:
code:
|
# ? Jun 28, 2020 05:07 |
|
Pulcinella posted:AppKit: The previous, long running way of making native Mac apps. Not deprecated or anything (at least not yet), but it’s probably not a good use of your time trying to learn it. This clarifies things so much, thank you! Will start with SwiftUI.
|
# ? Jun 28, 2020 05:12 |
|
brand engager posted:I had an annoying timewaster where I didn't know why stuff wrapped in AnyView wouldn't show up. Oof, that's a rough one. frogbs posted:I’m completely new to iOS development and have a simple app I want to try to make. In 2020, is starting with SwiftUI my best bet? I’ll be honest, it’s a little confusing figuring out the differences between AppKIt, Uikit, Catalyst and SwiftUI, but I think I’m starting to get it. SwiftUI is a good place to start. UIKit is there for anything you need that's missing from SwiftUI, and the SwiftUI tutorial even covers how to do that. You can ignore AppKit and Catalyst. It's true that you won't see many SwiftUI codebases out in the world, so if your goal is to get a job or something then maybe app number two or three should be UIKit? No need to worry about it in the beginning though.
|
# ? Jun 28, 2020 05:14 |
|
Anyone else unable to get previews to load in the XCode 12 beta? I get "Cannot preview in this file - failed to launch *app*", the erro in diagnostics reads "HumanReadableNSError: The operation couldn’t be completed. (OSStatus error -10825.)". I tried a completely blank app, as well as this guy's SwiftUI sample and got the same thing: https://github.com/jordansinger/mail-swiftui-sample.git I'm not a 2012 Mac Mini on Catalina with 16gb of ram, which i'd imagine is just about the lowest end thing that could run XCode at this point, so maybe that's my problem... Edit: I think I figured out what I was doing wrong, his example code for that app won't run on something that isn't running Big Sur and isn't multiplatform. The blank test app I was making also wasn't targeted to my MacOS version, so it failed. If I target any of the iOS simulators with a blank app things work fine! I also tried this multiplatform SwiftUI example and it works well on simulators: https://github.com/jordansinger/messages-multiplatform-swiftui-sample frogbs fucked around with this message at 00:34 on Jul 1, 2020 |
# ? Jun 30, 2020 23:28 |
|
I know this isn't completely on topic, but I'm trying to do Swift work on an Ubuntu install with VSCode (algorithms and data structures practice really), and everything works great except debugging. I've installed the most common lldb extension (CodeLLDB) and filled out the launch json. It launches, I can set breakpoints and step, etc, but I don't get variable information the way I expect. For instance the following code is a really simple example let myVar = 5 print("Hello, world!") All I want to be able to do is look in the variable window and see the value in the locals, or watch window, but it looks like the only name that it finds is some mangled name. When I type `p myVar` in the debug console in VS, it returns as though it has no value. I compiled the file with the -g switch, and if I load the file in lldb directly, I can print out the value of myVar. I'm just at a loss as to why I can't seem to get variable information through VS Code and the lldb extension. I've tried multiple versions of Swift, and Ubuntu. Worst case I can just get good with command line lldb, which is probably a really useful skill to have that I don't currently have, but for ease, I'd really like to get VS Codes debugger working. Does anyone have any hints or thoughts as to what might be wrong or something I could try? Thanks! mrbass21 fucked around with this message at 19:46 on Jul 4, 2020 |
# ? Jul 4, 2020 19:43 |
|
If it works in the command-line lldb, the problem’s probably at the VSCode extension layer.
|
# ? Jul 4, 2020 19:59 |
|
rjmccall posted:If it works in the command-line lldb, the problem’s probably at the VSCode extension layer. Thanks for the reply. That was my suspicion too. I just thought maybe I was doing something wrong. I see guide after guide setting things up the exact way I did and saying it works (I even tried Ubuntu 18.04 and Swift 5.0, which is exactly what another guide used), so unless VSCode made some update that broke it or the authors never actually tested that it worked, I figured I was doing something incorrectly.
|
# ? Jul 5, 2020 04:02 |
|
frogbs posted:Edit: I think I figured out what I was doing wrong, his example code for that app won't run on something that isn't running Big Sur and isn't multiplatform. The blank test app I was making also wasn't targeted to my MacOS version, so it failed. That’s exactly the case: New SwiftUI APIs are part of the operating system, not the compiler, so you can only preview them if you’re running the OS that has them (either natively in the case of macOS, or via a Simulator in the case of iOS/tvOS/watchOS).
|
# ? Jul 5, 2020 04:31 |
|
Is there a way to associate a constant or a series of constant variables to an enum, like you can do in Java with the private enum constructors? I would like to avoid making giant switch blocks like this: code:
code:
limaCAT fucked around with this message at 10:38 on Jul 7, 2020 |
# ? Jul 7, 2020 08:43 |
|
For that exact example (playing card suits) this is how I would define it:code:
Say you wanted to add a new property (e.g. royalCardFacesDirection): this way you can define another encapsulated function to handle it, whereas the init way you'd add 4 new lines intersperced through the initialiser.
|
# ? Jul 7, 2020 14:25 |
|
limaCAT posted:Is there a way to associate a constant or a series of constant variables to an enum, like you can do in Java with the private enum constructors? I'm not sure whether it's idiomatic, but this is another approach to consider: code:
All that said, for something like card suits that seems unlikely to gain new cases, I would go with an enum. This struct approach can be nice when you have some common or default values as static vars, but also want to make the initializer nonprivate to allow for new instances as desired.
|
# ? Jul 7, 2020 14:59 |
|
Last week I interviewed at a company for an iOS position, and one of the technical interviews was: A method in objective c was posted into coder pad, that dispatches to various queues, some threads performing some simple calculations and other threads printing out results. Next the interviewer posted a rudimentary test harness and said “QA says these tests are failing because x occurs” where x is some kind of unexpected result or the code never returns. The interviewer told me I could ask any questions I wanted, and he would give me QA’s response if I was making a code change, or talk through my logic for debugging. I don’t know how many situations like this he had ready to go, but in 50 minutes I solved the first one and with help had gotten to the end of the second. I didn’t get the job, which is legit, cause I don’t have experience doing this kinda stuff. My question is, if I want to get better at debugging multithreading bugs like this without being able to use instruments, how can I do that? What can I study for it?
|
# ? Jul 8, 2020 23:20 |
|
Thread Sanitizer is your best friend whenever threads are involved. Otherwise, it's tricky because a lot of issues are hard to recognize without a more complete understanding of concurrency. If a system seems to have stopped responding — either the UI has locked up or some internal system doesn't seem to ever respond to queries — something has probably deadlocked. If things aren't happening in a reliable order, you probably have a race, and there's something earlier that's supposed to make sure they happen in order. If some object looks like it's not fully initialized, but you're sure the code set it up right, you might have a memory-ordering problem.
|
# ? Jul 9, 2020 01:55 |
|
|
# ? Jun 10, 2024 10:33 |
|
Okay... FileWrapper. Typically, an image file (like a PNG) gets loaded into an app as image data, using UIImage. So when it is saved and loaded, it tends to look like this:code:
code:
Is there a way to skip UIImage, and instead just move the existing PNG into the FileWrapper? Also, when loading from the FileWrapper, is there a way to just point to the stored PNG file instead of allocating a data instance of it?
|
# ? Jul 10, 2020 20:08 |