so what did it take to post to a newsgroup or bbs? and what exactly did meower do? I mean we even used to have to pay for phone minutes back then. and they'd be pissed you were using the line. it wasn't like keeping open a browser window all day to shit post. you claim it was some kind of cultural evolution when there were so many other factors. if people could key cars with drones with no repercussions, it would happen more. same number of assholes.
Is there a way to schedule a background task, so that the system executes it whenever it deems appropriate?
I want to create a func that will check for updates on a server. This is not a time-sensitive task at all, and I don’t want to waste system resources forcing it to fire every x minutes
I just want to tell the system „fire this task whenever you feel is appropriate, preferably when you’re already doing other network calls“. Is this possible?
@mattiem Sweet! I will hit you up with so many questions you will regret this 😂 But seriously, thank you for being available. I'll give you a shotout in the next version of Cork :)
I’m getting pretty fluent at writing #Swift these days, but I still miss writing in #ObjC. I banged out a command-line tool in ObjC and it was glorious. I love the laid-back nature of the language, its verbosity that makes the code immediately readable, and its not-super-eagerness to get everything fixed up at compile time.
Would I recommend ObjC over Swift for new projects? No. I think most people will create better programs in Swift than ObjC. But I do miss those good old days. The Delegate pattern with optional methods is still exceedingly powerful and IMO yet to be surpassed with callbacks, builders, or what-have-you. The ability to cheat and directly examine the runtime without too much type safety in LLDB is extremely refreshing too.
What are the patterns/conventions to expose async closures in one place, and handle getting back to the main queue in another?
Context:
The Xcode warning here makes perfect sense:
"""
Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
"""
A dummy implementation of an async throws closure modified an view model directly. (It's annotated MainActor.)
I’ve done nearly 30 years of C/C++ by now, and probably 20 years of Objective-C. So usually, that's my baseline for programming. These languages don't hurt, they're just “how programming is”. Better languages are “oh cool I get to have fun”.
That said, I recently wrote some new Objective-C code and … actually wanted to go back to Swift. Those square brackets really are a downside of the language. The Swift-style of method call syntax is superior.
@chucker@bugaevc@js AFAIK that was a NeXTstep or OpenStep thing, and already gone by the time Apple bought NeXT.
The WebScript version might have shipped from Apple for a while longer, but as I come from the Apple side, not the NeXT side, all I know is vague third-hand knowledge and the odd PDF found on the web.
@davidbures@melgu@codedbydan That looks like what I ran into with the "id" property expected to be in the JSON data. I got around that by making my "id" property a computed property. JSONDecoder/JSONEncoder ignore those. I don't know if that would work for you in this case.
@puppethead@melgu@codedbydan Interesting idea, but it unfortunately doesn't work in my case. Making it a computed property makes my navigation stop working.
At times like this, I wish there was something like a @noncodable property wrapper that would allow you to exclude a property from the encoding/decoding process, instead of having to duplicate everything in CodingKeys :x
@ctietze@mattiem sounds like a combineLatest + compactMap to me? The first takes all source values + the user selection, the latter emits only the source value ones for the selected source?
@ctietze Yes! Themes would be cool! But, so you understand where I’m going here. In the medium term: Neon is about managing the state of text efficiently. All the tree-sitter stuff is going to migrate into SwiftTreeSitter. Theme support is going to live here:
> Unable to get connection interface: Error Domain=LNConnectionErrorDomain Code=1100 "Unable to locate com.apple.appintents-extension extension"
Thanks, macOS, that's suuuuper helpful. 🤨 Trying to move app intents into an Intents Extension. They show up in Shortcuts but error out when run. If anyone has some pointers, I'd be grateful
@czottmann Did you find a solution for this? I once had this error back in July, but could resolve it via defining a results type to the return value of the perform() method of the App Intent: ReturnsValue<MyFeedEntity> instead of just ReturnsValue. But since the newest macOS beta it is broken again.
@czottmann You also have to delete archives you created on the same Mac. Just had to learn that, after installing a TestFlight build. This is definitely a Sonoma only issue.
If you asked how @SwiftStudio going. Well... it been better. Apple #Swift just recently decided to shutdown #SwiftPM API I use (to make things CLI cannot provide). I find it unexpected (to me, not to apple) move after many years. https://github.com/apple/swift-package-manager/issues/7440
I'm disappointed with a move in that direction and find that decision harmful for the third-party dev tooling ecosystem trying to adopt SwiftPM. IMHO.
Lets say I have a number of arrays, in this case three: [a,b,c][d,e][f,g,h,i] and I want all elements at the first index, then the second, and so on, as long as there are elements. Result should be this: [a,d,f,b,e,g,c,h,i]
What would I call this function? (Is it a merge?) Is there anything anywhere that does this already in #swift? #swiftlang
@gernot@zeitschlag Plus, of course, zip will not return a flat array, but an array of pairs. It will work with different inputs array lengths, but naming yours based on zip would still imply a different behavior. Should have considered this before suggesting the name 😳.
So yes, interleave is much better 👍
I may be going about this the wrong way, but suppose I have a contains closure inside a filter closure. Now, I want to access the first argument, using the $0 syntax. The problem is, I don’t want to access the first argument of the nested closure, but the top-level closure. Check out the picture for an example.
I want to access the first element of the filter closure, not the contains closure. Am I going about this in a completely wrong way?
More Swift questions: Why is this index out of bounds?
import Foundation
let sampleData = Data([12, 0, 0, 0, 39, 95])
let a = sampleData[2...5]
guard a.count > 2 else {
fatalError("Expected 2, actual (a.count)")
}
let b = a[0...1]
// Swift/Collection.swift:714: Fatal error: Index out of bounds
@below Subarrays (or in this case) Subdata use the original index from where they come from. If you want zero based index, use let a = Data(sampleData[2...5]).
@mattiem Thank you for the offer! Favored solution 100%, but it's maybe not backdeployed, maybe it is, so not sure if we can wait for Xcode 15 RC 🤷♂️ @oliep
@arroz@krzyzanowskim@phranck@benboecker it’s ultimately not about the client, it’s about the service being able to close the barn door after horse has bolted - revoke and push back a DDoS until they move to new keys, or billing/usage tracking.
Apparently the name in NSPersistentCloudKitContainer(name: "") is supposed to be in bundle id format like "iCloud.com.yourDomain.YourAppName". And its supposed to match the iCloud container identifier.
I definitely did not know about or do it this way 😂
Is this true, and are there any long term consequences for not having it in this format?
@deanatoire oh good! Thanks for the link. I saw online that Apple recommended doing it that way and I’ll admit I don’t have too much knowledge on Core Data and all its quirks. So good to see that according to Apple, it doesn’t need to be in a bundle id format 😅
“With the increased limit of the acceptance queue, and a patched version of wrk, we can now conclude that swift is a good competitor speed-wise as a web application server.
Memory wise it blows all the other technologies away, using only 2.5% of the amount of memory that the java implementation needs, and 10% of node-js.”
@finestructure always seemed to me to be a weird benchmark where the endpoint has a heavy CPU load. Not very typical of a standard server. Some interesting discussion though. Not sure the decision to accept more connections when server is overloaded is very clever though.
@mattiem@davidbures absolutely, in fact as I was writing it I thought “wait but have I actually measured this?” So to be clear: It’s just conjecture on my part - or “a safe bet”. Also remember to only measure/profile release builds, especially in Swift and when dealing with data types, you may end realising that your latest genius 10x optimisation actually runs slower in release config :) (speaking from experience :D :D)
@aCertainBru@mattiem Reminds me how I was going crazy trying to optimize memory by only passing individual variables needed to views, and then I gave up and threw everything into a single @EnvironmentObject and memory consumption decreased by almost 1/3 😅
I had a hunch that I could take on tasks that I used to do with Python + matplotlib + Jupyter with Swift Charts + SwiftUI + Playgrounds instead. But I had no idea it’d be this nice and easy. Plus I find the default result better looking and I have much more control over everything around the chart, like labels, titles etc.
This will change everything for me when working with charts.
Since people asked, I’ve posted the self-contained example as a gist on Github and added a button to export the page as a PDF. Works wonderfully, even from within a simple playground 🎉
NB: the PDF is not rasterised - you can select the text and zoom in without any loss of fidelity.
I've had more opportunities recently to create plots with #SwiftUI / Swift Charts / #Swift playgrounds and the process absolutely holds up in replacing #python / #matplotlib / #jupyter.
The dataset was larger this time, ~100k records, each containing a handful of data points, exported from a Postgres DB as JSON.
Massaging the data in a typesafe way is an absolute blessing – it's so easy to plot the wrong thing in python as you drill through three dicts.
I can't resolve known good packages from github. & searching has failed me.
I get 1 of these 2 errors. Unclear why it seems to alternate. API token has FULL access. SSH Key verified (by me and it). HTTP & SSH cloning configs both fail. Wifey can install the same package(s) just fine.
"realm-swift" is irrelevant. it's just a known good package & version to eliminate potential errors related to the package itself.
The separate XCode bug we encountered:
I've been doing this a while & have been forced to jump through the 6 hells of GPG signing many times over the years. Consequently, I have my ~/.gitconfig configured Git to auto-sign all of my commits, with my SSH (not GPG) key.
I like knowing that all my commits to my public repos can be verified & weren't some malicious BS. You can fake the name & email on a commit trivially.
However, if I make a new XCode project w/ git it does this. 🎉
🧵5/?
This isn't actually a problem for me because i never use IDEs to manage git.
So, XCode can't handle GPG signing configured git setups, their error messages are god-awful, and I think they're absolute 🍆's for bundling all their 💩 into their 💩 IDE.
You know who doesn't use XCode at Apple? Everyone‡ who isn't coding in Swift/Obj-C. I'm not kidding. NONE of my coworkers used it. Why? Because there are tons of great IDEs / Editors out there that aren't XCode.
On my journey to convert SwiftyJSON in Cork to Codable, I ran into a slight problem. Some of the JSON I’m parsing has this format:
[{formula: { // the data that I actually need}}, cask: { // empty and I don’t care}]
Is there a way to access the data inside “formula”, without having to define Formula as a useless struct? Using SwiftyJSON for this made the code really nice, since I could directly access the data in there.
Today I finished day 23 of #100DaysOfSwiftUI
It was a tough one! @twostraws gave the introduction to the new project and so I learned a lot of new things about custom view modifiers and custom containers. I understand the logic behind it, but it’s still pretty complicated! I’m curious what we will do with that in the next project. #Swift#SwiftUI#iOSDev