Sign in

nythepegasus

@nythepegas.us
214 followers 592 following 26 posts

Silly iOS developer | forever tired | she/her 🪦❤️‍🔥🩵 💚0x69703320

PostsRepliesMedia
nythepegasus @nythepegas.us · 16/11/2024
lol this project idea is super dumb, but I’m having a lot of fun with learning Github CI junk
A picture of a successful Github Actions build of my project https://github.com/nythepegasus/XcodeTemplate that includes macOS, iOS, and tvOS builds as well as their corresponding dSYMs for debugging purposes
040
nythepegasus @nythepegas.us · 26/10/2024
Hey #Swift community, I’m working on my library more with building apps, and I’ve tried to provide a bunch of default init functions, and I’m now facing an issue of “ambiguous use of init.” I guess my main question is, what is the difference in the semantics below? Is this a #bug? hehe
Swift code with the following:
```swift
init(_ url: URL) async {
    do {
        self = try Self(json: try await URLSession.shared.data(from: url).0)
        self = try .init(json: try await URLSession.shared.data(from: url).0)
    } catch {
        print(error)
    }
}

```
020
nythepegasus @nythepegas.us · 21/10/2024
Here is a cat :3
The cat ‘Momma’ laying in her spot on a chair
060
nythepegasus @nythepegas.us · 21/10/2024
That’s fair, though here’s the implementation of the set functions as well as the bottom, haha. I’m mostly making this for my own personal helper library that I use for cross platform and other silly things. Just found accessing raw Data as bytes to be kinda tough
Swift code with the following
    mutating func set<T>(_ value: T, at index: Int) where T: FixedWidthInteger {
        var val = value
        Swift.withUnsafeBytes(of: &val) { bytes in
            self.replaceSubrange(index..<index+MemoryLayout<T>.size, with: bytes)
        }
    }
    
    mutating func setu8(_ value: UInt8, at index: Int) { self.set(value, at: index) }
    mutating func setu16(_ value: UInt16, at index: Int) { self.set(value, at: index) }
    mutating func setu32(_ value: UInt32, at index: Int) { self.set(value, at: index) }
    mutating func setu64(_ value: UInt64, at index: Int) { self.set(value, at: index) }
110
nythepegasus @nythepegas.us · 21/10/2024
Any #Swift devs wanna chime in with which they think is the least gross? Am I going about this the wrong way? Assuming data is var Data, and index is properly aligned (which for UInt8 should be any)
Swift code with the following:
data.set(84 as UInt8, at: index)
data.set(UInt(84), at: index)
data.setu8(84, at: index)
300
nythepegasus @nythepegas.us · 17/10/2024
Silly iOS app I’ve been working on with some fun secrets :3
130