Masthash

#SwiftLang

iOS Dev Weekly
17 minutes ago

Interoperability: Swift’s Super Power by Saleem Abdulrasool
https://iosdevweekly.com/issues/629#AjvP3Sj

#Swift #SwiftLang #iOSDev #MacDev

Rachel Brindle
19 hours ago

Nimble 13 RC 1 has been released! There are quite a few breaking changes here, notably the `Predicate` APIs have been renamed to `Matcher` (there are typealiases to make migrating easier).

Also, Nimble 13 adds support for Windows!

I'd love feedback on this before the actual release!

https://github.com/Quick/Nimble/releases/tag/v13.0.0-rc.1

#swiftlang #swift #UnitTesting

Matthaus Woolard
21 hours ago

I am loving the ability to show category and subsystem in the #Xcode 15 console window.

#iOSDev #SwiftLang

Xcode console window with the settings popover open with metadata settings.
Matthaus Woolard
21 hours ago

Found a fun little bug the other day in MapKit.

If you create a MKLocalPointsOfInterestRequest with a negative radius the constructor returns nil but the swift declaration does not expect an optional response.

Passing this to MKLocalSearch results in a crash.

#iOSDev #SwiftLang

let pointRequest = MKLocalPointsOfInterestRequest(
            center: point.coordinate,
            radius: radius
        )
        
        pointRequest.pointOfInterestFilter = .init(
            excluding: [
                .airport,
                .evCharger,
                .gasStation,
                .stadium
            ]
        )
        
        let search =  MKLocalSearch(request: pointRequest)
iOS Dev Weekly
23 hours ago

Thanks to this week’s sponsor, Stream. Stream makes it easy for you to seamlessly integrate real-time experiences into your application. Check out our Swift tutorial to learn how you can get started adding in-app messaging or video to your apps!
https://cur.at/Fg7RaTj

#Swift #SwiftLang #iOSDev #MacDev

iOS Dev Weekly
1 day ago

Did you miss Friday’s issue? I started with some words on the Settings app, and how I like the new Action Button settings screen.
https://iosdevweekly.com/issues/629#start

#Swift #SwiftLang #iOSDev #MacDev

Ryan Ashcraft
2 days ago

Swift structured concurrency 101 question: is using an actor (i.e. calling an async actor method that reads and modifies the actor's own properties) across multiple concurrent Tasks considered unsafe? #Swift #SwiftLang

Paul Samuels
4 days ago

Short post with a few examples of use cases for Swift 5.9's new Parameter Packs feature https://paul-samuels.com/blog/2023/09/29/swift-parameter-packs/

#swift #swiftlang

iOS Dev Weekly
4 days ago

iOS Dev Weekly, Issue 629 is out. Happy Friday, everyone! 🚀
https://iosdevweekly.com/issues/629#start

#Swift #SwiftLang #iOSDev #MacDev

Latt Hsiang
5 days ago

We made it, we depreciated it. #swiftlang

Marina Gornostaeva ✨
5 days ago

Issue #56 of  iOS Code Review Newsletter has just reached 2800+ inboxes 💌🚀 Read it and subscribe to future ones here: https://ioscodereview.com/issues/56/ #SwiftLang #iOSDev

Hans
5 days ago

My app @stempel on macOS 14 Sonoma does not work in iCloud Drive anymore, it worked fine on Ventura. If anyone from Apple is reading this, could you please take a look at FB13109005 (FIFinderSync not calling menu(for menuKind: FIMenuKind) when secondary-clicking in Finder)?

Basically custom Finder Extensions don’t work anymore in iCloud Drive – where I have all my data. The app I wrote for myself out of love does not work anymore – this is heart breaking.
#IndieDev #MacDev #SwiftLang

The right click menu in Finder showing a Finder Extension for creating new files.
Andrew
5 days ago

Hmm, don’t remember seeing this discussion line on the menuWillOpen docs and it seems Sonoma doesn’t like you populating menu’s as they open.
Repeated clicking (5x) on my menubar menu causes the width to get progressively smaller.
Wrapping my menu population in an DispatchQueue.main.async fixed it.
A search on GitHub shows so many projects populating their menu's without the async so putting this out there.
#MacDev #SwiftLang

Apple’s MenuWillOpen documentation
Matthaus Woolard
6 days ago

Has anyone found a good Codable lib that reads and writes raw bytes to file, currently I have gone down the path of creating my own `UnsafeCodable` that operates on raw pointers.

#Swift #iOSDev #SwiftLang

protocol UnsafeCodable {
    init(from ptr: inout UnsafeRawPointer)
    func encode(to ptr: inout UnsafeMutableRawPointer)
    var sizeInBytes: Int { get }
}
iOS Dev Weekly
6 days ago
iOS Dev Weekly
1 week ago
Brennan Stehling
1 week ago

@kharrison This can be hard to do on pre-existing projects with years of code. So what I like to do is create a new framework or package and migrate code over with this setting enabled. Gradually all code is organized into modules which can build with the strict build requirements. #SwiftLang

Brennan Stehling
1 week ago

Now you can use Swift to script games built with Godot. https://youtu.be/C7KZxlcLCg4?si=6Ps4TN8tYyDchDuA #SwiftLang #Godot #GameDev

iOS Dev Weekly
1 week ago
iOS Dev Weekly
1 week ago
iOS Dev Weekly
1 week ago

Thanks to this week’s sponsor, Essential Developer. If you're a mid/senior iOS developer looking to improve both your skills and salary level, join this free online crash course. It’s available only for a limited time, so get it now.
https://cur.at/UyEkwiN

#Swift #SwiftLang #iOSDev #MacDev

iOS Dev Weekly
1 week ago

Did you miss Friday’s issue? I started with some words on Apple's new Swift testing framework.
https://iosdevweekly.com/issues/628#start

#Swift #SwiftLang #iOSDev #MacDev

Is someone using #SwiftLint as a plugin in Swift packages with #Xcode 15? On Xcode Cloud I get this weird error messages…

#Swift #SwiftLang @swift

Chris
1 week ago

Immerhin noch Platz 9 beim #SwiftLang Quiz der @macoun 😁
Aber eine gute Bandbreite an Fragen!

Quiz Ergebnis Screenshot. Neunter Platz, 16 von 24 Fragen korrekt beantwortet mit einer Gesamtzeit von 7 Minuten und 35 Sekunden
heberle
1 week ago

I‘m an environmental #physicist by training, but after three years of parental leave I started a new job as a consulting software #developer. I work(ed) with a lot of different technologies: #swiftlang, #java, #csharp, #cplusplus, #angular, #perl, … My preferred computing platform is the #Mac.

In my spare time I love to play #tabletopgames of all kinds: #boardgames, #cardgames, #miniature games and #rpg’s. When I‘m by myself I also enjoy #sologames or (mostly) older #videogames.

#introduction

iOS Dev Weekly
2 weeks ago

iOS Dev Weekly, Issue 628 is (finally!) out. Happy Friday, everyone! 🚀
https://iosdevweekly.com/issues/628#start

#Swift #SwiftLang #iOSDev #MacDev

Tikitu
2 weeks ago

Really nice live-coding example of building a cute #swiftlang macro. I especially enjoyed the thinking out loud and iteration getting it working first then tidier and tidier. https://youtu.be/zeB-kmb74FY

Max Desiatov
2 weeks ago

Are you interested in cross-compiling your #SwiftLang apps to #Linux? We've got some great news for you! https://forums.swift.org/t/announcing-swift-sdk-generator/67409

Doug Gregor
2 weeks ago

Fantastic post from The Browser Company on interoperability being #SwiftLang’s superpower: https://browsercompany.substack.com/cp/137231709

iOS Dev Weekly
2 weeks ago
iOS Dev Weekly
2 weeks ago
iOS Dev Weekly
2 weeks ago
Deirdre Saoirse Moen
2 weeks ago

Didn’t have the details of a #SwiftUI grid exactly right on Friday (exhausting week), so I left it until this morning. Fifteen minutes with the (interactive with code generation!) Eager Grid builder here not only solved that problem, but showed an optimization I’d missed.

https://swiftui-lab.com/eager-grids/

#SwiftLang

Erwin
3 weeks ago

Heads up: the JSONEncoder in iOS 17/Swift 5.9 now encodes with keys in random order. Even though JSON has an arbitrary key order, object encoding used to produce a stable ordering. Not anymore.

#swiftlang #swift #ios

Marcin Krzyzanowski :clippy:
3 weeks ago

Swift concurrency API is contiguous. In order to solve MainActor warnings now I have to update upstream project (that doesn't need Swift concurrency) to start using it, in order to use another framework that requires Swift concurrency. #swiftlang

Turning on strict concurrency checking for all targets in a Swift package: https://useyourloaf.com/blog/strict-concurrency-checking-in-swift-packages/ #iOSDev #SwiftLang

Holly Borla
4 weeks ago

I am unreasonably excited about this #SwiftLang pitch for generalized tuple conformances, built on top of parameter packs. Hashable tuples here we come!!!

https://forums.swift.org/t/pitch-user-defined-tuple-conformances/67154

Doug Gregor
4 weeks ago

#SwiftLang SE-0408 "Pack iteration" is under review now! This proposal makes it possible to use Swift's for..in loop with parameter packs in an obvious and powerful way. We'd love your input over at https://forums.swift.org/t/review-se-0408-pack-iteration/67152

Kaylee's Devlog
1 month ago

I find this pattern works really well when you need a task that only runs when a View is on screen and the app is in the foreground, for example to drive an animation.

When the task's `id` parameter changes, a new task will be created and the previous one will be canceled.

So if we choose `scenePhase` as an `id`, we’ll get a new task for every phase. All we need to do is terminate all of them except the `.active` ones.

#SwiftUI #SwiftLang #iOSDev

Xcode screenshot of the following code

  @Environment(\.scenePhase) var scenePhase
  
  var body: some View {
    Rectangle()
      .task(id: scenePhase) {
        guard scenePhase == .active else { return }
        
        // ...
      }
  }
Marcin Krzyzanowski :clippy:
1 month ago

Who wears it better? #swiftlang

(isLetter || isNumeric) or CharacterSet.alphanumeric?

While CharacterSet is clearly documented, the Character.isNumber is not clear whether these are equivalents.

Fabian Fett
1 month ago

🧑‍💻⁉️ Please make your voice heard in the #Swift Server Working Group developer survey. Please do so, even if you don‘t use #SwiftOnServer today. We would love to understand your reasons.

#SwiftNIO #SwiftServer #SwiftLang

https://forums.swift.org/t/sswg-community-survey-2023/67084

Kaylee's Devlog
1 month ago

Another consequence of Twitter’s rebranding disaster: VoiceOver will read the standalone string “X” as “Cap[ital] X”, so you need to fix that every time :/

#SwiftUI #SwiftLang #accessibility #iOSDev #twitter #x

Xcode screenshot of the following code:

      Section("Socials") {
        Button { Mastodon.follow(WiprConstants.mastodonUser) } label: {
          Text("Mastodon")
        }
        Button { Twitter.follow(WiprConstants.twitterUser) } label: {
          Text("X").accessibilityLabel("x")
        }
      }
Adam Fowler
1 month ago

The Swift Server Workgroup has released a community survey to help inform its decision making process. If you are working in Server Side Swift please take part. https://forums.swift.org/t/sswg-community-survey-2023/67084 #SwiftLang #ServerSideSwift

#SwiftLang was always meant to scale down to extremely resource-constrained environments, so it’s really cool to see people starting to make it happen. https://forums.swift.org/t/embedded-swift/67057

Doug Gregor
1 month ago

The review for a minor improvement to #SwiftLang member macros is still ongoing and could use YOUR input: https://forums.swift.org/t/se-0407-member-macro-conformances/66951

Deirdre Saoirse Moen
1 month ago

Figured out my “app that worked in 13.4.1 but not 13.5” issue, related to what didn’t throw, but now does. (Hasty fix for Sonoma last week.)

In a FileManager extension function:

try removeItem(at: url)

…didn’t throw if the item didn’t exist (at least not in app’s narrow use case), but does in 13.5. Clearly more correct now.

Obvious workarounds:

* change try to try? (chose this one since app is not interested if it’s there)
* see if the file exists first

#SwiftLang #iOSDev #macOSDev

Uli Kusterer
1 month ago

Can a Swift async method return multiple results over time? Different types, so I don’t think I can use AsyncSequence? Something like (pseudocode)

let (showProgress: async Bool, result: async MyThing) = await doSomethingLengthy()
if await showProgress {
showProgressScreen()
}
processResult(await result)

?

doSomethingLengthy() would guarantee that doProgress is fulfilled before result, in case that helps.

Or must it be a 2-method delegate?

#swiftlang #programming #asyncAwait #coroutines

Padraig
1 month ago

Working with Notification objects from a `.notifications(named: …)` AsyncSequence in Swift concurrency without warnings is tricky. I took a run at wrapping the API here:

https://gist.github.com/PadraigK/c6d1bae4337d12508dea8d37cacdf3cc

This gives a really nice call site that returns exactly the data you want, but it does require a bit of boilerplate for each notification name + payload.

#Swift #SwiftLang

carlyn
1 month ago

Little update, I swear it’s still on target but, taking a minute to get Swift to talk to an Arduino board.

https://www.whynotestflight.com/excuses/can-i-open-a-serial-port-with-swift-part-i/

#Arduino #SwiftLang

Doug Gregor
1 month ago

Closed out a #SwiftLang bug filed on June 6, 2014: “Add a macro system to Swift” ;)

Carlo Zottmann
1 month ago

Anyone have any experience with implementing `AppIntents` @‍Parameter resolvers? https://developer.apple.com/documentation/appintents/resolvers I'm about to drop software dev over this stuff, ugh. How do I wire a custom resolver to this:

@‍Parameter(title: "", resolvers: ???)
var something: SomeEntity

Some Apple frameworks are a "d-light", this is one of them (as in "light on docs", i.e. actually usable ones). Apple should start spending a few million USD per year on several dozen technical writers.

#SwiftLang #Xcode @swift

Gernot
1 month ago

Haven’t tried yet, but could something like this work? #swiftlang #observable

Gernot
1 month ago

#Swiftlang question: Did somebody already build an AsyncStream that works on Observable, and emits on every change?

Gernot
1 month ago

I’d love to add properties in an extension to an @Observable Swift class; these properties are backed by UserDefaults.

This means:
- It needs to work without adding a stored property to the object
- It should call access() and withMutation() correctly
- This includes announcing mutation if the underlying UserDefaults change
- All this should be wrapped in a Macro or PropertyWrapper or something that makes it easy to use.

As usual, the #swiftlang naming makes it IMPOSSIBLE to google anything. 🤮

Russell Gordon
2 months ago

I never actually did this, so let’s give it a try.

17 years in #teaching, mainly computer science and sometimes mathematics at the high school level. Very grateful for what I’ve learned from so many dedicated and creative professionals. My students learn #SwiftLang and we do a lot of #iOSDev.

4 years in software before that, mainly #webdev with #PHP and writing a lot of XSLT. 😬

Doing my best to be a good father and spouse.

Love #running, #dogs, and #reading of all kinds.

#introduction

Naps are good. Naps on couches are better. This is Piper, my five year old Yellow Labrador.