|
brap posted:Does swiftpm work in Xcode yet Yes. Works well, even.
|
# ? Feb 5, 2020 15:12 |
|
|
# ? May 15, 2024 13:01 |
|
The wrong answer is to support CocoaPods. They are not good and the interactions I’ve had with their devs have solidified this. Go with Carthage or swiftpm IMO.
|
# ? Feb 5, 2020 18:34 |
|
brap posted:Does swiftpm work in Xcode yet Yes, and the integration is mostly great. The main awkwardness is that it works slightly differently from the command-line swiftpm tool and there's a bunch of functionality that's only available via xcode, but that probably doesn't matter to most people.
|
# ? Feb 5, 2020 19:03 |
|
I was thinking cocoapods because everyone and their dog uses it but I also know that's a pretty lovely justification on its own .
|
# ? Feb 5, 2020 19:40 |
|
When I talked to one at a WWDC a couple of years back they didn’t know what an ASCII plist was and insisted that they didn’t have to care, then complained about xcodeproj files not committing well because those numbers kept on changing (the ones introduced by the XML to ASCII plist conversion which they also didn’t know about). For something intended to integrate with Xcode projects that was a big yikes for me.
|
# ? Feb 5, 2020 19:51 |
|
Xcode projects aren’t XML though, they’re UTF-8 OpenStep plists read and written by our custom archiver.
|
# ? Feb 5, 2020 20:08 |
|
Okay so I spent all morning loving with xcframeworks and like 10 min with swiftPM and I don't care anymore, swiftPM is gonna be what we use come hell or high water. Amen.
|
# ? Feb 5, 2020 20:42 |
|
Good call! And agreed re: CocoaPods being bad. It's probably a requirement if you're making some library that needs to be incredibly easy for a wide audience to integrate. But if you can avoid it then you should absolutely avoid it. Can't wait until SwiftPM supports resources. Goodbye CocoaPods forever.
|
# ? Feb 6, 2020 02:07 |
|
eschaton posted:Xcode projects aren’t XML though, they’re UTF-8 OpenStep plists read and written by our custom archiver. Yes that’s my point. They didn’t care about ASCII plists’ existence, partly because Xcode at the time helpfully converted the plist to that format, but the numbers used for cross referencing objects were no longer the same, causing the merge issues in the first place. The terminology “ascii plist” is commonly used to refer to the text plist format even if it’s actually utf8 because it’s primarily text based and not XML. Doctor w-rw-rw- fucked around with this message at 02:26 on Feb 6, 2020 |
# ? Feb 6, 2020 02:23 |
|
Is there a way to 'train' the quick open (command-shift-o) in Xcode? I'm working in a view controller every day, but the quick open defaults to a model object I haven't touched in months.
|
# ? Feb 10, 2020 17:57 |
|
Can anyone achieve the result shown in the Apple docs for the CIFilter CIHeightFieldFromMask? I'm using the black and white text image used in the docs. I get back the same result as the input image. I tried the default input radius, and various input radii using a UISlider that ranges from 0 to 100. code:
Good Sphere fucked around with this message at 19:48 on Feb 12, 2020 |
# ? Feb 12, 2020 18:05 |
|
My only issue with swiftpm is that it doesn't support custom schemes yet. Otherwise it's great. What are y'all doing for oauth 2? I was trying to roll my own solution and I'm timeboxing it.
|
# ? Feb 12, 2020 22:23 |
|
I just switched a project over from Carthage to SwiftPM and it was Gonna go through and switch over anything else I can next week.
|
# ? Feb 14, 2020 07:30 |
|
Is there a preferred way to cross compile a Swift app for Ubuntu? If possible I'd like to make my builds with GitHub Actions or locally and scp them to my server to run them. The advice I've seen online is to run vagrant and compile with an Ubuntu VM and deploy that. Seems a bit convoluted but not too terrible.
|
# ? Feb 17, 2020 02:06 |
|
You mean compile some server-side Swift on your Mac and run it on Ubuntu? Seems like you should be able to do so with the Docker images. I imagine most people deploying server-side Swift right now are just building their application on their server, or using an Ubuntu VM or Docker image to do so.
|
# ? Feb 17, 2020 03:29 |
|
Glimm posted:Is there a preferred way to cross compile a Swift app for Ubuntu? https://github.com/compnerd/swift-build let me know if you need any help with that
|
# ? Feb 17, 2020 06:44 |
|
Doctor w-rw-rw- posted:https://github.com/compnerd/swift-build Thanks, I'll check it out! https://swift.org/blog/preview-package/ This looks awesome, a Swift package for previewing future standard library updates.
|
# ? Feb 19, 2020 03:39 |
|
Doctor w-rw-rw- posted:When I talked to one at a WWDC a couple of years back they didn’t know what an ASCII plist was and insisted that they didn’t have to care, then complained about xcodeproj files not committing well because those numbers kept on changing (the ones introduced by the XML to ASCII plist conversion which they also didn’t know about). I kinda want to know who you talked to so I can properly picture this interaction. Also, not that anyone here appears to be, but I wouldn't recommend anyone betting big on Cocoapods in general. It's currently being abused for dependency management @ Square but once they're done with it the main devs probably won't be spending much time supporting it.
|
# ? Feb 19, 2020 06:52 |
|
Does anyone know if Apple will start requiring support for split screen on iPad from April? This talk said that they would, but this item says that it's 'strongly encouraged'.
|
# ? Feb 21, 2020 10:47 |
|
I got back to working on that network stuff after a few months of working on other tickets, and that NwTCPConnection class is some clown poo poo. The callback for the read function won't be called until either there's data or the connection breaks, with no way to check if there's pending data to read. You also aren't supposed to read/write again until the callback runs. So what ends up happening is you guess whether there might be data from the remote host, and if you guess wrong that connection is just unusable until the connection times out. I swapped to these stream-based classes instead which have their own weirdness (gotta use UnsafePointers), but are still easier to work with: https://developer.apple.com/documentation/foundation/streams_sockets_and_ports. The delegate those use is pretty nice too, it'll let me know when it's got data from the remote host.
|
# ? Feb 23, 2020 04:24 |
|
Are extensions limited to 15MB of memory? I had my vpn thing going with the debugger attached, and it hit 15MB while trying to load all of forbes's bullshit and got killed.
|
# ? Feb 25, 2020 01:44 |
|
I don't believe custom keyboards, share extensions, or the notification extensions are so limited. But they don't run all the time, only on demand, so that's probably not a useful comparison. If it helps, that sounds like a limit that's undocumented and prone to change without warning between point releases. Your experimenting is likely to be the best source of info (alongside devforums posts. Definitely try a search there, if you haven't already, and try posting a thread if you come up empty). Also, some limits and behaviors change when a debugger's attached, so I recommend experimenting both with and without. (My guess is that a memory limit wouldn't change, but who knows.)
|
# ? Feb 25, 2020 03:32 |
|
I'm not sure why I was even holding onto that much memory. I'm using the foundation Data class for buffers, and I thought those auto-release the memory when they get de-inited. Maybe I have a retain cycle keeping a reference to some of them that's keeping them from being cleaned up
|
# ? Feb 25, 2020 03:41 |
|
They should free up (unless you're using the initializer that says not to). You can use the memory graph thinger while attached with the debugger to see what has references to what, it's the debug toolbar icon that's a couple circles connected by lines.
|
# ? Feb 25, 2020 03:51 |
|
Cool I'll see if I can find them with that at work tomorrow.
|
# ? Feb 25, 2020 04:00 |
|
Is anyone use Apollo GraphQL in Swift? Having a problem where `nil` arguments are being sent as `null` instead of being omitted.
|
# ? Feb 25, 2020 18:48 |
|
I was thinking about mucking around with some audio reactive visual thingos and was wondering if there is a core library for reading data from whatever current state of the audio output stream is on iOS devices? Or is this the kind of thing that would involve setting up a music picking interface in the application itself? edit: yeah ignore, i can see its a dumb question and would probably be a security vulnerability if you could observe the devices audio output. guess ill mess around with playing music the proper way. soundsection fucked around with this message at 10:11 on Mar 4, 2020 |
# ? Mar 4, 2020 09:59 |
|
I tried to subclass NSTimeZone for use with an NSDateFormatter, overriding methods like secondsFromGMT(for:). But the formatter never calls my time zone??? So much for that idea. If corelibs-foundation is anything to go by, the formatter just passes the time zone identifier down into ICU, and obviously my custom identifier is unknown to ICU. What's the point of the NSTimeZone methods if all it does is wrap an identifier string? Just an old API? Thought I was being so clever.
|
# ? Apr 2, 2020 05:00 |
|
I've got a side-project which I use as my playground for improving my Swift knowledge, and I'm not sure whether what I'm trying to do is possible or not, getting muddy with Generics. I have a bunch of endpoints that I've standardised to return data in the format:code:
code:
The part I'm struggling with is decoding the JSON response in a generic way, and handling the "error" property in one place before getting into branching code for the different result types. Because JSONDecoder needs the Type passing as a parameter, I can't find a way to do this without explicitly defining every decoding case in a switch statement, which means the error handling has to be repeated too: code:
code:
Is there a way to make this work, or does Swift's type inference prevent it? I've tried to find code snippets doing a similar thing (as I figure it's some minutiae of the syntax I'm getting wrong) but nothing has come up.
|
# ? Apr 13, 2020 19:43 |
|
Froist posted:I've got a side-project which I use as my playground for improving my Swift knowledge, and I'm not sure whether what I'm trying to do is possible or not, getting muddy with Generics. I have a bunch of endpoints that I've standardised to return data in the format: There's a library I use for all of this that does exactly that: https://github.com/Moya/Moya Check out the docs for usage and the code for how it's done, it's all pretty straight forward once you see it.
|
# ? Apr 13, 2020 23:26 |
|
I don't think you can pass a protocol to decode, has to be a real type
|
# ? Apr 13, 2020 23:26 |
|
I think you'd have more luck representing your endpoints as separate types or functions rather than enum cases. `fetchAndHandleData` can be a method extension on the generic protocol your endpoint types conform to, or a generic helper function that your endpoint functions call.
|
# ? Apr 15, 2020 02:28 |
|
My code's here. USBDetectionDevice.h/.m is basically a glorified struct. USBDetectionDetect.m/.h are where the meat of this is. The behavior I'm seeing is that when I compile it as is, it detects nothing. Ever. However, if I compile it with lines 59 and 63 of USBDetectionDetect.m commented out (the CFDictionarySetValue calls), it detects all the USB devices attached to the host and works as I'd expect . . . but only once. It doesn't detect newly-plugged in devices. It does detect disconnection of the devices that were plugged in when it was first run, but it doesn't detect reconnection of them. Is there anybody here who might have any ideas about where I'm going wrong? Never mind. I rewrote it and it works now. Kreeblah fucked around with this message at 00:35 on Apr 16, 2020 |
# ? Apr 15, 2020 20:26 |
|
I've been spending the past several months learning Swift and SwiftUI, and I've reached a point where I'm feeling somewhat comfortable building different kinds of apps. However, I'm currently running into an issue with my current project. I'm building aSwiftUI Mac OS app which receives MIDI input from a controller and displays the notes pressed to the corresponding grids onscreen. I have MIDI input working and a basic GUI made, but I'm running into two issues with displaying the note pressed on the grid. The grid is created dynamically using SwiftUI Grid and ranges from 0-127 (for the small version). I've written a series of methods which map the MIDI input to the grid, and right now I'm able to respond to button presses by using .overlaypreferencevalue from anchor preferences in combination with Published variables from the combine framework. Here's what it looks like when 4 notes are held on the MIDI controller at once. Although it currently works I'm running into two issues: Firstly, as you can see in the screenshot, the same notes repeat themselves a few times on the grid, but only one grid element is mapped per note. I did this by creating a method that converts MIDI notes to locations on the onscreen grid like so (128 values for the small MIDI controller version): code:
Secondly, when no button is pressed, the location of .overlaypreferencevalue is set to 0. This causes the highlight rectangle to start in the very first grid element. Is there a way to make this hidden? I can't seem to set this to a value outside the index since I'll get an out of bounds error. This is what it looks like when no MIDI keypress is detected.
|
# ? Apr 28, 2020 00:51 |
|
Froist posted:But this fails with "Cannot invoke 'decode' with an argument list of type '(Decodable.Type, from: Data)'", which I don't really understand if I'm honest as it seems to match the function signature. This is a bit of a hole currently. You'd need to use `_openExistential` to effectively open the Decodable.Type to get the concrete type which can then be decoded. You'd need to know which type you want though.
|
# ? Apr 28, 2020 21:13 |
|
Stringent posted:There's a library I use for all of this that does exactly that: https://github.com/Moya/Moya brand engager posted:I don't think you can pass a protocol to decode, has to be a real type dizzywhip posted:I think you'd have more luck representing your endpoints as separate types or functions rather than enum cases. `fetchAndHandleData` can be a method extension on the generic protocol your endpoint types conform to, or a generic helper function that your endpoint functions call. Simulated posted:This is a bit of a hole currently. You'd need to use `_openExistential` to effectively open the Decodable.Type to get the concrete type which can then be decoded. You'd need to know which type you want though. Thanks for all the pointers! It basically confirmed I wasn't missing something and what I wanted can't be done. I ended up refactoring to scrap the generics and switch to a protocol with the common fields defined as vars, so a common handler can cast to that protocol and check the common error cases. I'd hoped to avoid duplicating these common field variables into each endpoint definition, but overall the code I've ended up with is far cleaner.
|
# ? Apr 29, 2020 12:11 |
|
Froist posted:Thanks for all the pointers! It basically confirmed I wasn't missing something and what I wanted can't be done. If it isn't proprietary I'd love to see your code for this. I'm always looking for different ways to do this since it comes up so much. *edit* Actually after rereading I think I get how you're doing it, but post the code if you can by all means. Stringent fucked around with this message at 12:29 on Apr 29, 2020 |
# ? Apr 29, 2020 12:25 |
|
Stringent posted:If it isn't proprietary I'd love to see your code for this. I'm always looking for different ways to do this since it comes up so much. Sure, it's only for a hobby project so happy to share. I've removed the specific endpoint URLs and cut it down to a minimal case - in practice there are more endpoints, a caching system so the data isn't always fetched from the server, and proper error handling, but this (hopefully) demonstrates the design pattern. It works fine for me in practice but happy to receive any code review/improvement suggestions! https://pastebin.com/NAsjbSLc I did look into Moya that you suggested but it didn't quite do what I wanted. Plus I'm not that keen on pulling in libraries when (for something reasonably simple) I can roll my own solution and learn along the way. I'd rather have 100 lines of code that I understand myself and does only what I want than a more flexible library I have to learn. Obviously there are limits to this
|
# ? Apr 29, 2020 15:10 |
|
Froist posted:I did look into Moya that you suggested but it didn't quite do what I wanted. Plus I'm not that keen on pulling in libraries when (for something reasonably simple) I can roll my own solution and learn along the way. I'd rather have 100 lines of code that I understand myself and does only what I want than a more flexible library I have to learn. Obviously there are limits to this Yeah no doubt, I use Moya because if I didn't I'd just have to rewrite it. And I may end up doing so anyhow for my laziness. Looking forward to having a look at your code in the morning. Stringent fucked around with this message at 15:20 on Apr 29, 2020 |
# ? Apr 29, 2020 15:16 |
|
|
# ? May 15, 2024 13:01 |
|
I created this mapview deal, and then I want to do a thumbnail view up above. Do I have the mapview update the controller (that handles the zoom slider) and then have the controller relay that back to the thumbnail view? (coordinates of current view, size of the mapview, and the current zoom factor so it can generate a colored box the size of the current 'view') It's not really a thumbnail but an indicator of where the current view is on the grand scheme of however large the map coordinates could be. But anyway. That just seems...kind of goofy. Maybe I should just have the mapview draw the thumbnail opaquely in the corner of itself. It'd be simpler. But then what am I going to do when I allow the user to select walls/things, and need to show the texture and other info related to that object? Would I have a property of the mapview with the ID of the currently selected object, and then just highlight that in another window that has all the textures? Something like [[self superview] updateToolsWindow]? I do like one Cocoa project every 3 years and can never remember the best ways to link up different views.
|
# ? May 1, 2020 01:09 |