#development

1 messages Ā· Page 240 of 1

grim sparrow
#

where theres usually a wifi network

wooden yarrow
#

it surely would have been useful back when there was no connection between iphones and macbooks for calling

lime pivot
#

hm I thought that was said to be misunderstood, rather a custom wifi/bt chip, not 4G/5G

#

I remember this being rumored as a sure thing back in like 2011 though lol

#

way more viable now though with the type of battery life Apple Silicon gets

magic hazel
#

Alright time to start on my writeup

wooden yarrow
#

where'd you get the info that it's a WiFi/Bluetooth chip?

wooden yarrow
magic hazel
#

applying for dev role

#

surely

#

Thoughts on the writeup?

#

Any suggestions?

#

I will be creating a git repository for those who want the build script for the toolchain, as well as the compiled toolchain and a build script that automatically builds with no code-signing required and changes info.plist after build time from 7.0 to 6.0

lime pivot
magic hazel
#

ā€œA generous individualā€

lime pivot
#

through applesparkles mysterious circumstances applesparkles this lost media fell in your lap

magic hazel
#

Indeed indeed

#

What about the rest?

#

It’s my first so I’m open to improvement

#

I did my best to make it enjoyable to read

manic forum
#

also shortening r/jailbreak to r/jb may not be a good idea in this case

lime pivot
#

still be careful, because I don't imagine many people download that specific release

magic hazel
magic hazel
#

Hopefully it’s not too boring

#

It was pretty enjoyable to write

#

It was a funny chain of events anyways

lime pivot
#

still reading but it looks good

#

it's the type of post that hacker news would like to read

magic hazel
#

Idk if that’s a compliment or a bad thing

lime pivot
#

good thing

#

you should post it there

magic hazel
#

Alrighty

lime pivot
#

honestly Swift compiler engineers might see it and have some lore to share in the comments

magic hazel
#

Compiling swift 3 was an actual pain

#

I sat for hours staring at the build slowly progressing hoping each time it’d be the time

lime pivot
#

the toolchain stuff is crazy, but also for Apple, doesn't surprise me

magic hazel
#

Idk what I expected

#

Honestly I’m not sure why they removed iOS 6 support

#

When I mean stable on swift 2.2 I mean it’s like it was built for it

#

You get no indication that it’s weird

#

Or wrong

#

It’s perfect

lime pivot
#

they've changed their mind a lot on how legacy support works

magic hazel
#

Yeah

#

I mean they supported iOS 7 for a while to be fair

#

And the idea of bundling swift with the app was a great one for legacy compatibility

magic hazel
lime pivot
#

it was iOS 4.3 for a long time, then 6.0, then 9.0 for a very long time, but recently it seems they now target the past 5 versions only

magic hazel
#

Yeah

#

It’s because the APIs move so fast now

#

SwiftUI as an example has changed drastically

#

5 versions is 13-18

#

Could not be more distinctly different

lime pivot
#

I'd say mainly because SwiftUI keeps changing its mind on how things should work every year, and Apple's policy is just, tell your users to update

magic hazel
#

I guess, it’s kind of petered out in recent years though thankfully

#

Ever since SwiftUI 17

#

It’s been pretty consistent

#

And SwiftUI 26 was a big step forward to making SwiftUI less dependent on UIKit

#

I’m confident one day it’ll mature enough to be viable as a stand-alone ui module

velvet path
#

it's only device debugging that has bumped a lot from what I recall

#

(Swift could be different though and SwiftUI was only introduced in 13 and wasn't useful until 14 at a minimum though)

fading shell
#

<@&355174844205367317>

kind herald
#

Ty

faint lionBOT
#
James A. Bell deleted a message

@kind herald :3

fading shell
#

wtf

#

hacked

light owl
# faint lion

@kind herald Hey this was offtopic can you tell him

#

@native dune Btw is it working

kind herald
#

@fading shell Offtopic in development buddy

#

Better move to the correct channel buddy

hexed knot
#

Does anybody know how I could capture Bluetooth packets on ios

#

Jailbroken

wooden yarrow
hexed knot
#

I don't have a Mac

#

Probably should've said that

native dune
#

Not sure if it works for BLE, but you can install one of those debug profiles and it'll show in analytics data under accessoryd-packets

#

Might be iAP2 or Bluetooth classic only

silk gull
#

How to compile a tweak on Theos for Mac Catalyst app on x86_64 Mac? I add x86_64 to Makefile but has both error on iOS and Mac targets, also loader and pspawn doesn't compile for x86_64, only libellekit

inner imp
#

Trying to programmatically open this view

rocky oriole
#

you could make a feedback for it but I doubt it would go anywhere

timid furnace
#

they might actually work but be blocked

#

to know for sure you'd need a jailbreak

inner imp
#

oh apple...

inner imp
#

but the latest version is ios 15 while im on 18.6.2 on a 13 pro

#

idk if that would matter

timid furnace
#

it works on my iPad

#

which is on iOS 16

#

let me try a shortcut

#

wtf it broke

#

let me make sure it wasn't a placebo

#

yea it doesn't work

#

rip

inner imp
timid furnace
#

it looks like they're restricted somehow

#

there's definitely URL schemes

#

otherwise clock wouldn't open

inner imp
#

yeah ik

timid furnace
#

the macOS app has them (same behavior on macOS)

inner imp
#

so i think these schemes are managed by ios itself

inner imp
#

hmm

wooden yarrow
inner imp
#

no way to get there without a jb right

wooden yarrow
#

you just go to a URL

#

quite a coincidence because I literally downloaded that yesterday to analyse the clock app

inner imp
timid furnace
#

you can get system apps pretty easily

#

but in any case you're out of luck if these schemes don't work

inner imp
inner imp
#

but why are they blocked?

timid furnace
#

Idk

timid furnace
#

build ID and system image ID are from SystemVersion.plist

#

or if you're unjailbroken you can use ie. ideviceinfo

#

or even an app on device since it's an unsandboxed path

inner imp
#

im a little confused on how to get these ID's?

timid furnace
#

idk you can use shortcuts or ideviceinfo

#

the full path is /System/Library/CoreServices/SystemVersion.plist

inner imp
#

is ideviceinfo only for linux?

timid furnace
#

no

timid furnace
#

@wooden yarrow you sure it's a system app

timid furnace
#

oh it's mobiletimer

wooden yarrow
#

i have it right here

timid furnace
#

thanks apple

wooden yarrow
#

lmao

#

i didnt know how to parse the concatenated zip .data so i had to scroll to the correct offset with hex editor and remove everything before it

timid furnace
#

smh

#

dd

wooden yarrow
#

which i think was probably like ios 14 ish

timid furnace
#

ĀÆ_(惄)_/ĀÆ

inner imp
#

but idk why it downloaded Safari??

wooden yarrow
#

if you just extract it normally

#

it just extracts the first of the concatenated zip files

#

so you have to find mobiletimer in the zip hex and extract that

inner imp
#

wait so the .data contains all the apps or?

wooden yarrow
#

yes

#

thats why its like

#

100 mbs

inner imp
#

441mb

#

wtf apple

wooden yarrow
#

oh i see that it has gotten bigger

inner imp
#

but why?

#

why do this

wooden yarrow
#

only tim apple would know

inner imp
#

also, is this how the native apps get updated when you update the ios?

timid furnace
#

yes

wooden yarrow
#

there's patches in the OTA though

inner imp
wooden yarrow
#

its from ios 18 latest

#

or well

#

near latest,

inner imp
#

thanks but i have no use for it

#

schemes are blocked anyways

#

i wanted to learn more abt how all of this worked, so thats the only reason i went into the rabbit hole

magic hazel
#

Okay so now that swift works on iOS 6, how is tweak development in swift

rocky oriole
#

sw*ft

hexed knot
#

It's pretty mid

#

Unless it changed

magic hazel
#

yeah i always kinda got the vibe that tweak dev was built for obj c

#

which is fine

#

getting swift to work on ios 6 was hard enough on its own

radiant idol
#

@convention(c) seems to have been added in Swift 2 so you're good on that part

magic hazel
#

like guard let

radiant idol
#

more or less

magic hazel
#

guard let is so nice

radiant idol
#

but you do need to do stuff manuially where in Logos you have %hook and whatnot

magic hazel
#

wheres that?

#

yeah tehres quite a bit of verbose swift code here that looks quite like its obj c counterpart but thats expected

radiant idol
#

The objective-c counterpart in Logos would be far less verbose tbh

#

for example

magic hazel
#

right because you're not patching over obj c stuff

#
struct Dynamic {
    private let className: String

    init(_ name: String) {
        self.className = name
    }

    func alloc<I>(interface: I.Type) -> I {
        guard let cls = objc_getClass(className) as? AnyClass else {
            fatalError("Could not find class named \(className)")
        }

        let allocSelector = sel_getUid("alloc")

        guard let allocMethod = class_getClassMethod(cls, allocSelector) else {
            fatalError("Could not find alloc method in \(className)")
        }

        let allocIMP = method_getImplementation(allocMethod)

        let alloc = unsafeBitCast(allocIMP, to: (@convention(c) (AnyClass, Selector) -> Unmanaged<AnyObject>).self)

        let instance = alloc(cls, allocSelector).takeRetainedValue()
        return unsafeBitCast(instance, to: interface)
    }
}```

number 1 rule for me in swift, if i see alloc, i'm getting the hell out of there
radiant idol
#
struct CCUIModuleSettingsManagerHook {
    private static var origIMP: IMP?

    static func hook() {
        guard let targetClass = objc_getClass("CCUIModuleSettingsManager") as? AnyClass else { return }

        typealias HookType = @convention(c) (NSObject, Selector, String, CCUILayoutSize) -> CCUIModuleSettings

        let hook: HookType = { target, selector, identifier, prototypeSize in
            let orig = unsafeBitCast(Self.origIMP, to: HookType.self)

            if identifier == "com.apple.control-center.DisplayModule" || identifier == "com.apple.mediaremote.controlcenter.audio" {
                let size = CCUILayoutSize(width: 2, height: 1)
                return Dynamic("CCUIModuleSettings")
                        .alloc(interface: CCUIModuleSettings.self)
                        .initWith(portraitLayoutSize: size, landscapeLayoutSize: size)
            }

            return orig(target, selector, identifier, prototypeSize)
        }

        MSHookMessageEx(targetClass, sel_getUid("moduleSettingsForModuleIdentifier:prototypeSize:"), unsafeBitCast(hook, to: IMP.self), &origIMP)
    }
}
%hook CCUIModuleSettingsManager

- (CCUIModuleSettings *)moduleSettingsForModuleIdentifier:(NSString *)identifier prototypeSize:(CCUILayoutSize)prototypeSize {
    if ([identifier isEqualToString:@"com.apple.control-center.DisplayModule"] || [identifier isEqualToString:@"com.apple.mediaremote.controlcenter.audio"]) {
        CCUILayoutSize const size = CCUILayoutSizeMake(2, 1);
        return [[%c(CCUIModuleSettings) alloc] initWithPortraitLayoutSize: landscapeLayoutSize:];
    }

    return %orig;
}

%end
radiant idol
magic hazel
#

still pretty verbose

magic hazel
#

its a pretty cool idea, i'll give you that, but again, alloc in my swift code? hell no

radiant idol
#

look at where it's used

magic hazel
#

yeah right okay

#
Dynamic("CCUIModuleSettings")
                        .alloc(interface: CCUIModuleSettings.self)```
radiant idol
#

yeah tbh I would say it's a pretty elegant solution to an otherwise really difficult problem to solve

magic hazel
#

i agree tbh

#

idk it's just the kinda code that i use swift to avoid

#

however, i see no other way of doing it

radiant idol
#

you write it once and forget about it tbh

#

so

magic hazel
#

i guess so yeah

#

that's what i'm doing with my swift 3-5 backport library

radiant idol
magic hazel
#

i didnt realise how many functions i relied upon from swift 4 particularly

#

.random() didnt even exist until then

#

you had to use the god awful arc4random

#
extension Array {
    func randomElement() -> Element? {
        if self.isEmpty { return nil }
        let index = Int(arc4random_uniform(UInt32(self.count)))
        return self[index]
    }
}```

this vs 
.randomelement()
lime pivot
#

no preprocessing

radiant idol
#

agreed yeah that would be really cool

lime pivot
#

of course, not pre-Swift 5.whatever compatible

magic hazel
#

yeah obv

#
import Foundation
import UIKit

// Helper structs to fake Swift 4+ ranges
struct RandomClosed {
    let min: CGFloat
    let max: CGFloat
}

struct RandomHalfOpen {
    let min: CGFloat
    let max: CGFloat
}

// Overload the ... and ..< operators to return our structs
func ... (lhs: CGFloat, rhs: CGFloat) -> RandomClosed {
    return RandomClosed(min: lhs, max: rhs)
}

func ..< (lhs: CGFloat, rhs: CGFloat) -> RandomHalfOpen {
    return RandomHalfOpen(min: lhs, max: rhs)
}

// CGFloat extension
extension CGFloat {
    static func random(in range: RandomClosed) -> CGFloat {
        let diff = range.max - range.min
        return CGFloat(arc4random()) / CGFloat(UInt32.max) * diff + range.min
    }
    
    static func random(in range: RandomHalfOpen) -> CGFloat {
        let diff = range.max - range.min
        return CGFloat(arc4random()) / CGFloat(UInt32.max) * diff + range.min
    }
}

#

random(in: 0...1) syntax

#

tbh my implementation is kinda wacky

#

but it works

#

all i needed was the effect and syntax to be identical so you can just copy paste swift code and have it compile

#

i cant really see any way of doing that without doing what i've done

#

it works quite well

#

and its pretty intuitive if you think about it

#

a lot of changes will just be like this though

extension UIViewAutoresizing {
    static var flexibleWidth: UIViewAutoresizing {
        return .FlexibleWidth
    }
    
    static var flexibleHeight: UIViewAutoresizing {
        return .FlexibleHeight
    }
}
#

and i mean a LOT

#

just camelcase changes

#

ts gonna take me forever

radiant idol
#

at this point you're just fighting the language lol

magic hazel
#

eh

#

not really

#

once you code it once

#

it works

#

and its so much cleaner

#

the idea is you never see this

#

i write it

#

you download the folder

#

import it

#

boom

#

plus ill add compile checks so you can use it on swift 3, swift 4

#

so you just get whatever you're missing

#

this was a must have


import Foundation
import UIKit


//Swift 3 Timer
class ClosureTimer: NSObject {
    let block: (NSTimer) -> Void
    
    init(block: (NSTimer) -> Void) {
        self.block = block
    }
    
    @objc func fire(timer: NSTimer) {
        block(timer)
    }
}

extension NSTimer {
    
    // Swift 3-style API
    class func scheduledTimer(withTimeInterval interval: NSTimeInterval, repeats: Bool, block: (NSTimer) -> Void) -> NSTimer {
        let closureTimer = ClosureTimer(block: block)
        return NSTimer.scheduledTimerWithTimeInterval(interval,
                                                      target: closureTimer,
                                                      selector: #selector(ClosureTimer.fire(_:)),
                                                      userInfo: nil,
                                                      repeats: repeats)
    }
}



typealias Timer = NSTimer```
#

this one is honestly pretty simple

#

really just converting the syntax into a closure but MAN it is so much nicer to not have to rely upon obj c selectors

#
NSTimer.scheduledTimerWithTimeInterval(interval, target: closureTimer, selector: #selector(ClosureTimer.fire(_:)), userInfo: nil, repeats: repeats)


Timer.scheduledTimer(withTimeInterval: 1, repeats true) { _ in

}```
#

its not even close

#

syntax is so much cleaner

#

oh yeah i wanted feedback on this, i implemented addAction from iOS 14 UIKit but i did it slightly differently, any thoughts

private class ClosureSleeve {
    let closure: () -> Void
    init(_ closure: () -> Void) {
        self.closure = closure
    }
    @objc func invoke() { closure() }
}

extension UIButton {
    func addAction(for controlEvents: UIControlEvents, _ closure: () -> Void) {
        let sleeve = ClosureSleeve(closure)
        addTarget(sleeve, action: #selector(ClosureSleeve.invoke), forControlEvents: controlEvents)
        // Use NSUUID for unique key
        objc_setAssociatedObject(self, NSUUID().UUIDString, sleeve, .OBJC_ASSOCIATION_RETAIN)
    }
}```
#

so its just button.addaction(for: .TouchUpInside) {
your code
}

#

its as simple as can be

lime pivot
#

lowercase first letter seems like something that could be done

magic hazel
lime pivot
#

that's fair. you would still need to write a parser in python or something of course

#

to figure out if the symbol is a type that needs to be camelcased

#

also not sure if the format really contains every symbol, or only ones that needed overrides from default objc -> swift symbol naming behavior

grim sparrow
magic hazel
#

I had to research it quite a bit

#

I still don't fully understand it

#

Since it's an objc type

#

But

#

I kinda gotthe gist

#

I was worried i migh've stuffed solmething up

#

i'm not great with the more technical side of swift

magic hazel
#

Nothing on my dev role request yet woeis

#

Finally got a real Mac

#

Going from an HDD to an SSD is so big

#

It takes the computer from being slow as fuck to genuinely usable

#

MacBook Pro 2011

#

Oh and I upgraded the ram from 4->16gb

#

Back when apple actually allowed us to upgrade our computers

magic hazel
#

wow setting up git repos is so much more painful on older xcode versions

#

to use it just download the folder and take the one thats at the same level as info.plist

#

copy into your project and then drag it into xcode

#

should work fine

#

i havent added compile checks yet so be wary of that

magic hazel
#

what project structure would you use for uikit

#

is it mvvm

radiant idol
#

usually MVC

magic hazel
#

Alr

#

that's kinda sorta what i'm using rn

#

i mean

#

most of my logic is actually in the view controller

#

i assume i'd just do like

#

let model = ModelClass()

#

and then just use the methods from there?

radiant idol
#

usually the view controller "houses" the view

#

so you shouldn't really be accessing the controller from the view, rather the opposite

magic hazel
#

i have viewcontroller.swift

#

i have model.swift

#

inside model.swift i have a model class

#

inside viewcontroller.swift i do let model = ModelClass()

#

and then use the modelclass logic to link to ui

#

for example if i want a button to do something from my model like
button.addAction(for: .TouchUpInside) {
model.buttonaction()
}

radiant idol
#

do you have an example of what you're talking about? that may be easier to comprehend rather than just general examples

magic hazel
#

errr

#

yep

#

model

//
//  ColourChanger.swift
//  Colour Snap Legacy
//
//  Created by JWI on 31/08/2025.
//  Copyright Ā© 2025 JWI. All rights reserved.
//

import Foundation
import UIKit

class colourChanger {
    var backgroundColor: UIColor = .red
    var onBackgroundColourChange: ((UIColor) -> Void)?
    var titleColor: UIColor = .red
    var onTitleColourChange: ((UIColor) -> Void)?
    
    var lastColour: UIColor = .clear
    var currentColour: UIColor = .clear
    var exclusions: Set<UIColor> = [.clear]
    
    var onColourChange: ((UIColor) -> Void)?
    
    var timer: Timer?
    
    /*func DONTTOUCH() {
        timer = Timer.scheduledTimer(withTimeInterval: 2, repeats: true) { timer in
            
            withAnimation(1.5, animation: .CurveEaseInOut) {
                
                self.lastColour = self.currentColour
                let avaliableBackgroundColours = colors.filter( { !self.exclusions.contains($0) } )
                
                if let safeNewColour = avaliableBackgroundColours.randomElement() {
                    self.currentColour = safeNewColour
                    self.exclusions.remove(self.lastColour)
                    self.exclusions.insert(self.currentColour)
                    self.onColourChange?(self.currentColour)
                }
                
                
            }
        }
    }*/
    
    func backgroundColourChanger() {
        let _ = Timer.scheduledTimer(withTimeInterval: 2, repeats: true) { _ in
            withAnimation(1.5, animation: .CurveEaseInOut) {
                self.backgroundColor = UIColor(red: .random(in: 0...0.5), green: .random(in: 0...0.5), blue: .random(in: 0...0.5))
                self.onBackgroundColourChange?(self.backgroundColor)
            }
        }
    }
    
    func titleColourChanger() {
        let _ = Timer.scheduledTimer(withTimeInterval: 0.6, repeats: true) { _ in
            self.titleColor = UIColor(red: .random(in: 0.5...1), green: .random(in: 0.5...1), blue: .random(in: 0.5...1))
            self.onTitleColourChange?(self.titleColor)
        }
    }
}```
#

viewcontroller

#

//
//  GameViewController.swift
//  Colour Snap Legacy
//
//  Created by JWI on 31/08/2025.
//  Copyright Ā© 2025 JWI. All rights reserved.
//

import Foundation
import UIKit

class GameViewController: UIViewController {
    let backButton = UIButton(type: .custom)
    var myColourChanger: colourChanger = colourChanger()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        myColourChanger.backgroundColourChanger()
        
        let backgroundView = UIView(frame: view.bounds)
        
        self.view.backgroundColor = UIColor(red: .random(in: 0...0.5), green: .random(in:0...0.5), blue: .random(in:0...0.5))
        
        myColourChanger.onBackgroundColourChange = { newColour in
            backgroundView.backgroundColor = newColour
        }
        
        view.addSubview(backgroundView)
        backButton.setTitle(" Back to main menu ", for: .normal)
        backButton.translatesAutoresizingMaskIntoConstraints = false
        backButton.backgroundColor = UIColor.gray.colorWithAlphaComponent(0.4)
        backButton.layer.cornerRadius = 15
        backButton.layer.shadowRadius = 5
        backButton.layer.shadowColor = UIColor.black.CGColor
        backButton.layer.shadowOpacity = 0.5
        backButton.adjustsImageWhenHighlighted = false
        backButton.addAction(for: .TouchUpInside) {
            let mainMenuVC = MainMenuViewController()
            mainMenuVC.modalTransitionStyle = .crossDissolve
            self.presentViewController(mainMenuVC, animated: true, completion: nil)
        }

        view.addSubview(backButton)
        view.layoutIfNeeded()
        

        
        setupConstraints()
        
        

    }
    
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        backButton.titleLabel?.font = UIFont.systemFontOfSize(backButton.frame.width*0.1)
    }
    
    
    func setupConstraints() {
        view.addConstraint(NSLayoutConstraint(item: backButton, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0))
        view.addConstraint(NSLayoutConstraint(item: backButton, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .top, multiplier: 1, constant: view.frame.height*0.05))
        view.addConstraint(NSLayoutConstraint(item: backButton, attribute: .width, relatedBy: .equal, toItem: view, attribute: .width, multiplier: 0.5, constant: 0))
        view.addConstraint(NSLayoutConstraint(item: backButton, attribute: .height, relatedBy: .equal, toItem: backButton, attribute: .width, multiplier: 0.2, constant: 0))
    }
}```
radiant idol
#

whoa okay, this is very interesting

magic hazel
#

what part

radiant idol
#

the colourChanger part

magic hazel
#

why's it interesting

radiant idol
#

well for one, one nitpick I have is it should be ColourChanger, using UpperCamelCase for classes

magic hazel
#

ig

#

the only interesting part is me figuring out you can use a variable like ((UIColor) -> Void) to run a function whenever a varible changes

#

so the ui updates

#

usually i'd use @Published on swiftui but there's none of that here

radiant idol
#

but more so I have not seen that type of architecture in a UIKit project

#

the thing you have that's a "model"

magic hazel
#

How so

#

What would it usually be

#

Where would you store the methods you intend to use

radiant idol
#

You would put them directly in the view controller

magic hazel
#

that's extremely odd

#

so

#

there's no seperate layer

#

everything goes in the viewcontroller

#

no model at all

radiant idol
#

Or a delegate

magic hazel
#

huh that's weird, sounds like a way to get a really really large viewcontroller

radiant idol
#

that is more or less what happens

magic hazel
#

1 file storing every single method, class, action seems like a bad idea

radiant idol
magic hazel
#

ima avoid it like the plague

#

store all the logic in a seperate file

#

import it as a variable

radiant idol
magic hazel
#

like you would in swiftui

radiant idol
magic hazel
#

but with a viewmodel

#

ehhh

#

why both

#

just have it seperated

#

its so much nicer to think about

#

one file is ui

#

one file is model

#

you can essientally take an arrow

#

and drag it to your uielement

#

when this element clicked -> run this function from model

#

its also reusable

#

this is kinda what i'm attempting to replicate

#

oh shit its not public

#

bcus published app

radiant idol
#

I mean, structure it how you want, but just mentioning that a lot of UIKit projects are not structured like this so you're kind of fighting against the standard

radiant idol
magic hazel
#

my coloursnap repo

#

lmao

radiant idol
#

I see

magic hazel
#

so like in swiftui i would do this
this is my colourmatch model

mutating func colourGameChanger() {
        var exclusions = Set(currentGameColours)
        
        if countSinceMatch < 10 {
            for x in 0..<currentGameColours.count {
                
                lastGameColours[x] = currentGameColours[x]
                
                let avaliableColours = colourArray.filter( { !exclusions.contains($0) } )
                
                if let safeNewColour = avaliableColours.randomElement() {
                    currentGameColours[x] = safeNewColour
                    exclusions.remove(lastGameColours[x])
                    exclusions.insert(safeNewColour)
                }
            }
            
            countSinceMatch += 1
        }
        else {
            if let randomRectangle = currentGameColours.indices.randomElement() {
                currentGameColours[randomRectangle] = chosenMatchColour
            }
            countSinceMatch = 0
        }
    }
    
#

then in my viewmodel id import the function

#

then in my view i'd reference with viewmodel.colourgamechanger()

radiant idol
#

by the way, just a reminder to follow best code practices and mark variables as let if you're not going to be mutating them

radiant idol
magic hazel
#

i mean if uikit is just dump everything in one file idk how ppl can mantain a large project

#

if everything from my old swiftui game was in one file i would crash out

radiant idol
#

I did not say put everything in one file, I said put stuff on the view controller, not the model
you can most definitely still separate out the files, and also unlike SwiftUI, you have a lot more custom views in UIKit so that you can reuse things
In SwiftUI you can get away with copy pasting a VStack with some elements inside everywhere but in UIKit you might wanna think about the actual view grid

magic hazel
#

Really? nearly everything in swiftui for my thing was a custom view

radiant idol
#

You definitely could still try using an MVVM approach in UIKit as well, no problem with that, but to my knowledge that's not as common

radiant idol
magic hazel
#

thats wild

#

i tried that at first and it was so painful

#

the code was unreadable

#

now baselevelview is clean

radiant idol
#

There's a balance to be had, obviously refactoring every single thing into its own view is gonna become unmaintanable at some point as well

magic hazel
#

the only downside is having to share values

#

grrr

radiant idol
#

what just happened

magic hazel
#

too big a text i imagine

radiant idol
#

I see

magic hazel
#

WHAT

#

THAT WASNT EVEN LARGE

#
VStack {
                    pauseButton
                    
                    levelScoreView.zIndex(12)
                    
                    changingRectangleView.zIndex(viewModel.gameStatus == .won ? 13 : 10)
                    
                    matchColourView
                    
                    if !initialStart {
                        beginButton
                    }
                    
                    if !storeKitManager.hasPurchased{
                        bannerAd
                    }
                }```
radiant idol
#

oh, like that

#

mm

magic hazel
#

btw those views aren't inside the baselevelview

radiant idol
#

are those just a bunch of viewbuilders or what

magic hazel
#

they're inside other files

radiant idol
#

but why is it not like PauseButton()

#

MatchColorView()

magic hazel
#

cus it's not a function

radiant idol
#

It shouldn't be a function

magic hazel
#

its a struct

radiant idol
#

it should be a struct conforming to View

magic hazel
#

it is

#

//
//  YouWonFlyingView.swift
//  ColourMatchV2
//
//  Created by JWI Master on 24/6/2025.
//

import SwiftUI
import ConfettiSwiftUI

struct YouWonFlyingView: View {
    //MARK: Shared Variables
    @ObservedObject var uiColourChanger: ColourMatchGame.ColourChanger
    
    @State var offsetY: CGFloat = -800
    @State var opacity: Double = 0
    @State var go: Bool = false
    var body: some View {
        Text("You won!")
            .font(.custom("Moodcake", size: 35))
            .offset(y: offsetY)
            .opacity(opacity)
            .confettiCannon(trigger: $go, openingAngle: Angle(degrees: 0), closingAngle: Angle(degrees: 360), radius: 200)
            .compositingGroup()
            .onAppear {
                withAnimation(.interpolatingSpring(mass: 1, stiffness: 250, damping: 20)) {
                    offsetY = 0
                    opacity = 1
                    go.toggle()
                }
            }
    }
}

#Preview {
    YouWonFlyingView(uiColourChanger: ColourMatchGame.ColourChanger())
}
#

but swiftui has never indicated you'd say ()

#

unles

radiant idol
#

Where do you declare pauseButton?

magic hazel
#

you need to pass variables

magic hazel
#

thats tiny tho

#

its a single button

#

the only time i have to use view() is when im passing values to that view

#

OH

#

right

#

nvm

#

actually

#

im dumb

#

you're right

radiant idol
#

is that a @ViewBuilder var?

#

I see

magic hazel
#

i declared those later

#

in the file itself

radiant idol
#

I gotcha

magic hazel
#
var matchColourView: some View {
        Text("Your colour is: \(viewModel.chosenMatchColourName)")
            .padding()
            .background(RoundedRectangle(cornerRadius: 12).foregroundStyle(viewModel.chosenMatchColour))
            .modifier(iOS26GlassEffect(enableGlass: enableGlass, useShape: true, shape: .rect(cornerRadius: 12), cornerRadiusForNonGlass: 12))
    }```
#

like that

#

well

#

not like that

#
var changingRectangleView: some View {
        BaseChangingRectangleView(
            viewModel: viewModel,
            showWinMenu: $showWinMenu,
            showLoseMenu: $showLoseMenu,
            levelStarted: $levelStarted,
            blurOpacityOn: $blurOpacityOn
        )
    }```
#

there

#

like that

radiant idol
#

I see, cool cool

magic hazel
#

damn i'm forgetting the syntax already, guess you lose it if you don't practice

#

man the one thing i like about swiftui is how compact is it

#

you can just do everything in like one line

radiant idol
#

It's important to know and understand both thinking strategies, the imperative programming of UIKit and the declarative programming of SwiftUI

magic hazel
#

.padding() .font .shadow

#

instead of

#

seperate line EVERY TIME

#

takes up so much space

#

button.layer.shadow
button.layer.shadowcolor
button.settitle
Button.addaction
button.backgroundcolor

#

swiftui would be button("stuff", action: { stuff }).padding().shadow().font().backgroundcolorstyle()

#

one liner

#

uikit is like 7

radiant idol
#

I mean if you really look at it it's basically the same thing

magic hazel
#

ofc it is

#

its identical

#

its just so much less verbose in swiftui

radiant idol
#

just mentally take away button at the beginning and you pretty much have the same concept

radiant idol
#

As long as you write good code*

magic hazel
#

compared to 1

radiant idol
#

Maybe if there's one, but all of those (since there's multiple), would go on separate lines

magic hazel
#

yeah but like it's attached to one declaration

#

its
button
.this
.that
.there

#

instead of button.this
Button.that
button.there

#

and its inside ()

magic hazel
#

also i just found out YOU CANT EVEN ANIMATE MOST THINGS IN UIKIT

#

its so cooked

#

you cant even animate textcolor

radiant idol
#

Uh, you should be able to

magic hazel
#

nope

#

cant

#

you have to use CATextLayer()

#

UILabel's have like no animatable properties

#

it's cooked

radiant idol
#

How are you animating?

magic hazel
#

under the hood, UIView.animatewithduration

#

for nicer syntax, withAnimation

radiant idol
#
UIView.transition(with: yourLabel, duration: 0.3, options: .transitionCrossDissolve, animations: {
  self.yourLabel.textColor = .red
}, completion: nil)

This seems to work, according to stackoverflow

magic hazel
#

yes i know but YOU CAN ANIMATE BACKGROUND COLOR with uiview.animate

#

the idea of withANimation is to hidethat bad syntax

#

also its attached directly to a view

#

which is annoying

radiant idol
#

well again, you're fighting UIKit now

#

that's why you're having the hurdles you're having

magic hazel
#

the fact that you need .transition for textcolor and .animatewithduration for background color makes no sense

#

why are they two different things

#

swiftui is withAnimation for literally everything

radiant idol
#

I was surprised as well, but there's most likely some sort of under the hood reason

radiant idol
magic hazel
#

grrr now i have to write a check into my withAnimation extension to see if the property uses .transition or .animatewithduration woeis

radiant idol
#

No, just use the native syntax, imo

#

in this case it's fine as it is

#

other stuff I understand, like the closure based buttons - but this is something you can still work with just fine

magic hazel
#

selector based buttons give me headaches

#

they are so dumb

#

it really should not be that freaking hard to make a button do something

#

hence why apple made it better in ios 14

#

but man it took them a long ass time

radiant idol
#

They are inconvenient to use in Swift, I agree - they were more rooted in Objective-C, as you can obviously see, with the @objc syntax

magic hazel
#

yes exactly

#

idk why they stuck around so long

#

i even prefer my closure syntax to apples

#

its a real closure

#

and im pretty proud that i remembered to make sure the action isn't deallocated

#

(i broke my rule of no alloc in swift)

radiant idol
#

objc_setAssociatedObject makes perfect sense in your case

#

so, good job there

magic hazel
#

ngl i still dont full understand the fact you can just create a closure out of thin air and add it to a function but chatgpt explained it well enough for me to be able to piece together that extension

#

ngl without chatgpt i wouldve been half as good at programming, idk why ppl use it to code for them rather than to teach them

#

its like stackexchange on steriods

radiant idol
#

When I started programming it wasn't a thing yet, so a lot of the work was manual
But with the advent of ChatGPT and Claude, they have been nice tools to use to assist with certain things, but they are still nowhere good enough for complicated tasks
I still mostly go on Google for my questions, and only resort to AI if I'm really desperate, before asking other people for help

magic hazel
#

for me i just use it to debug errors

#

its so useful for that i find

#

it takes forever to find someone who has/understands a specific error on google

#

it takes seconds for chatgpt to generally figure it out decently

#

mostly its never quite right

#

but its enough for me to understand whats actually going wrong

#

so i can fix it myself

radiant idol
#

Yeah I mean if you're working with a semi-common error then it should be alright, but if you're deep in a rabbithole then it probably won't be able to help you

magic hazel
#

ngl it was actually kinda fire helping me build swift 3

#

and there was NOTHING online about that

radiant idol
#

That's good

magic hazel
#

oh yeah i made a little writeup documenting my process

#

swift 3 is kinda cooked before final commit

#

its really funky

#

methods are still ()

#

.main() instead of .main

#

.red() instead of .red

radiant idol
#

.main isn't really a method though, as you probably know

magic hazel
#

indeed

radiant idol
#

It's a computed variable

magic hazel
#

yes but its written like it is

radiant idol
#
@objc(UIScreen)
public class UIScreen: NSObject {
    public static var main: Self {
        // ...
    } 
}

something like this

magic hazel
#

yeye

#

which is why it makes 0 sense to do main()

#

its main

radiant idol
#

Well, it was .main() before, an actual method

magic hazel
#

yes

radiant idol
#

not a computed var

magic hazel
#

but its odd that its halfway in between

#

close to modern syntax

#

still a method

radiant idol
#

Oh you mean that in between stage of Swift 3

magic hazel
#

yes

radiant idol
#

I thought you meant the syntax in general

magic hazel
#

ngl that final commit is so big

#

it basically does the whole great renaming

#

its like 13k lines added

#

šŸ’€

radiant idol
#

lol

magic hazel
#

it added pretty much all the classes ios 6 doesnt understand

#

anyways my backport takes care of all the renaming

#

or it will

#

.mainScreen() to .main

#

the idea is you can copy paste swift 3 code to and from swift 2.2

#

and have it compile in both

#

plus some added goodies

#

i genuinely don't understand why swift didnt get .randomElement() and .random until swift 4

radiant idol
#

I like the idea, but I think you're conflating two different things, the backporting stuff, which I think is great and interesting, but also some of the SwiftUI convenience that you want to bring over to UIKit. The latter is nice, but I think it would be better as a separate package because it's not really related to the rest of the "compatibility layer"

magic hazel
#

oh yeah its in its own folder

#

and its just withAnimation

#

bcus the uikit animate method is extremely verbose

radiant idol
#

No no I mean its own project/repo or whatever

magic hazel
#

right

#

yeah i was thinking of that

#

possibly even a largish backport of swiftui in general

#

idk if its possible in swift 2 tho

#

maybe in swift 2 WITH swiftcompatkit

#

its an excellent port of UIStackView

#

it's syntax and methods are basically identical

radiant idol
#

I think that should work

magic hazel
#

how do you specify the animation being used tho

#

my withAnimation is
withAnimation(1.5, animation: .Animation) {
}

#

i dont see any way of specifying animation without being verbose

#

if you can tho ill get rid of withanimation

#

yeah no you need delay, animations and completion to use .options

#

maybe i should make an extension to allow you to autofill those

radiant idol
#

Good point, hm:

extension UIView {
    func animate(withDuration duration: CGFloat, options: UIViewAnimationOptions = [], animations: () -> Void, completion: () -> Void) {
        self.animateWithDuration(duration, delay: 0, options: options, animations: animations, completion: completion)
    }
}
#

something like that I guess

magic hazel
#

i see

radiant idol
#

or even

#
extension UIView {
    func animate(withDuration duration: CGFloat, delay: NSTimeInterval = 0, options: UIViewAnimationOptions = [], animations: () -> Void, completion: () -> Void = { _ in }) {
        self.animateWithDuration(duration, delay: delay, options: options, animations: animations, completion: completion)
    }
}
#

then you would be able to specify things as needed

magic hazel
#

alr

#

ill test

#

grr ima try xcode 7

#

8*

#

7 is pissing me off

#

groups aren't folders???

#

why tf does the project just dump all the files in the project folder

#

😭

radiant idol
#

oh yeah that's ridiculous

magic hazel
#

then again, ill have to take the ios 9 sdk

#

bcus a bunch of methods im using in xcode 7 exist in the ios 10 sdk

#

seperate from swift

#

like NSTimer.scheduledTimer

#

and ill have to use swift 2.3

#

hmm

#

ill make a copy of the project

#

my god this old mac is loud

#

its actually pretty fast tho

#

i cannot stress how much of a difference an ssd made

#

and then the ram on top made it even better

#

this machine is nearly fully usable

#

xcode runs smooth asf

#

at least xcode 7

#

idk about xcode 8

#

oh and ill have to force it to target ios 7 as well

#

grr

#

i think xcode 8 was the big update

#

it added auto profile management

#

finally ill be able to properly sign my app

radiant idol
#

lol

faint timber
#

@visual meadow sshrd 18.2 broken I guess?

visual meadow
#

I guess so, is that fixed in your iboot64patcher

#

I can update it if so

faint timber
#

@visual meadow will look but in the meantime irecovery and finder detect dfu but sshrd says [*] Waiting for device in DFU mode still

#

not on my mac but someone else

visual meadow
#

What device are they trying to use

#

With it

faint timber
#

ipad 7

visual meadow
#

Alr I can probably take a look sometime soon but i havent had that happen to any mac users weird

#

Usually its linux because of udev or whatever

faint timber
#

@visual meadow wait lsusb might not be preinstalled

visual meadow
#

I think I use a different thing for macOS but you're right about that

#

For linux users

#

That script is due for a rewrite i just havent really felt like it to be honest

faint timber
visual meadow
#

What macos are they on?

#

I really hope its not tahoe, and if they changed something there

magic hazel
#

without that xcode continually thinks theres something there that just isnt

visual meadow
#

dammit

#

of course they changed something like that

#

Ill have to look when I get time or feel like it

#

But I'm heading to bed

faint timber
#

@visual meadow lol iOS 18 already works you are using v26 instead of v29

visual meadow
#

I see

#

I'll fix it tomorrow probably

faint timber
#

lsusb -v works on mac but it needs to be installed

magic hazel
#

Okay that was thebiggest shitshow ever

#

So because Xcode introduced that new api

#

It's basically impossible to compile

#

No matter what you od

#

If you start replacing toolchains and copying sdks it just freaks out

#

so xcode 7 it is

visual meadow
#

I really dont want to make the user do more work to get stuff

faint timber
magic hazel
#

That’s huge

#

UIStackView for iOS 6 UIKit

#

So useful

#

Now to try and understand the code and potentially rewrite it in swift

grim sparrow
#

icl before i learnt the art of the stackview i would just add height width leading and trailing constraints to all my subviews in a for loop

magic hazel
#

its nearly like swiftui!!

magic hazel
#

šŸ’€

magic hazel
#

takes more work but

#

it actually does end up doing what i want to do

#

this is great

#

this will work really well

#

this is a really big development

#

i'm making big strides in making ios 6 development more approachable

#

i'm also adding some uikit stuff from neweev ervsion

wooden yarrow
magic hazel
#

what do those even do

#

also NSAttributedStrings are ios 6?

#

actually no

#

ios 3.2

wooden yarrow
#

inline images

magic hazel
#

UILabels have inline nsattributedstrings

wooden yarrow
magic hazel
wooden yarrow
#

nsattributedstrings changed over time

magic hazel
wooden yarrow
#

no that's the html webkit thing

magic hazel
#
let label = OHAttributedLabel(frame: CGRect(x: 10, y: 50, width: 300, height: 50))

// Basic text
let text = "Hello {star} world!"
let attributedString = NSMutableAttributedString(string: text, attributes: [
    NSFontAttributeName: UIFont.systemFontOfSize(16),
    NSForegroundColorAttributeName: UIColor.blackColor()
])

// Replace {star} with image
let image = UIImage(named: "star.png")!
let attachment = NSTextAttachment() // We won’t use it directly, just as placeholder
let imageString = NSMutableAttributedString(string: " ", attributes: [
    NSFontAttributeName: UIFont.systemFontOfSize(16)
])

// OHAttributedLabel provides a method to embed images
label.setText(attributedString, afterInheritingLabelAttributesAndConfiguringWithBlock: { (mutableStr) -> NSMutableAttributedString in
    let range = (mutableStr.string as NSString).rangeOfString("{star}")
    
    if range.location != NSNotFound {
        // Replace placeholder with image
        let attachmentStr = NSMutableAttributedString(string: " ")
        let attachment = NSTextAttachment()
        attachment.image = image
        attachment.bounds = CGRect(x: 0, y: -3, width: 16, height: 16)
        attachmentStr.appendAttributedString(NSAttributedString(attachment: attachment))
        
        mutableStr.replaceCharactersInRange(range, withAttributedString: attachmentStr)
    }
    
    return mutableStr
})

label.sizeToFit()
self.view.addSubview(label)
wooden yarrow
wooden yarrow
wooden yarrow
# wooden yarrow this doesn't help with inline images whatsoever

in fact it's explicitly stated that "Unfortunately, I no longer have time to maintain this class. Moreover, as since iOS6, UILabel now natively support NSAttributedStrings, this component is totally obsolete now (and maintaining it requires a lot of work for little benefit with recent projects all supporting iOS6+)."

magic hazel
#

oh well

#

yeah nah this is way beyond the rest of my helpers maybe ill get to it

#

wait why dont you just use html

wooden yarrow
magic hazel
#

i mean, doesn't every dc client

#

how are you currently embedding emojis

wooden yarrow
wooden yarrow
magic hazel
#

I mean, my ports rn have really been api renames with SOME backports of nonexistent types

#

hwoever

#

they're always based off types that do exist

#

and can be made into an overarching type

#

this doesn't exist in any capacity

#

DTCoreText seems like itd work

#

This is useful for drawing simple rich text like any HTML document without having to use a web view

wooden yarrow
magic hazel
wooden yarrow
magic hazel
#

yep

#

exactly

#

what's wrong w that

#

seems pretty simple to me

harsh junco
#

This is cursed

magic hazel
#

how??

#

its just basic html

#

😭

harsh junco
# magic hazel how??

so do you just want <p>%s</p> and <img src="%s" /> and for me to sprintf it into html

magic hazel
#

yes

#

i saw

#

i read it

#

again

#

how is that cursed

#

in any way shape or form

harsh junco
#

@slim bramble we need a phd paper on how using swift is related to human brain degradation

magic hazel
#

lol

#

i mean

#

if you can't use it

#

ig skill issue

#

i could use that perfectly fine

#

in fact im considering it in my swift legacy discord port

harsh junco
#

.

magic hazel
#

i mean realistically the question that HAS to be asked is what is your alternative

#

and the alternative as plx has stated is manual positioning

#

i would take this ANY DAY over that

#

of course, i'm sure both me and plx would love to hear an alternative solution

#

it doesn't really matter how "cursed" or non cursed it is, on old ios, if it works, it works

#
var rectArray: [UIView] = []
        
        
        for _ in 0...3 {
            let x = UIView()
            x.backgroundColor = .red
            x.layer.cornerRadius = 12
            rectArray.append(x)
        }
        
        
        let spacer = SpacerView()
        spacer.translatesAutoresizingMaskIntoConstraints = false
        
        
        
        let stack2 = UIStackView(arrangedSubviews: rectArray)
        
        let stack = UIStackView(arrangedSubviews: [backButton, stack2, newText])
        
        stack2.axis = .Vertical
        stack2.spacing = 10
        stack2.distribution = .FillEqually
        stack2.alignment = .Center
        stack2.translatesAutoresizingMaskIntoConstraints = false
        
        
        stack.axis = .Vertical
        stack.spacing = 10
        stack.alignment = .Center
        stack.distribution = .Fill
        stack.translatesAutoresizingMaskIntoConstraints = false
        

        view.addSubview(stack)
        
        setupConstraints()
        view.layoutIfNeeded()
        
        view.addConstraint(NSLayoutConstraint(item: stack, attribute: .Top, relatedBy: .Equal, toItem: view, attribute: .Top, multiplier: 1, constant: 20))
        view.addConstraint(NSLayoutConstraint(item: stack, attribute: .Bottom, relatedBy: .Equal, toItem: view, attribute: .Bottom, multiplier: 1, constant: -20))
        view.addConstraint(NSLayoutConstraint(item: stack, attribute: .Leading, relatedBy: .Equal, toItem: view, attribute: .Leading, multiplier: 1, constant: 20))
        view.addConstraint(NSLayoutConstraint(item: stack, attribute: .Trailing, relatedBy: .Equal, toItem: view, attribute: .Trailing, multiplier: 1, constant: -20))```
#

funni uistackview

harsh junco
magic hazel
#

inline emojis

#

go for it

#

custom emojis not system ones

harsh junco
magic hazel
#

pardon? that's not "it". that's him asking for a better solution than what he has

#

what he has is literally drawing an image next to the text

#

which is basically just as bad

#

manually finding where the image needs to be drawn and drawing it there

#

which is very fragile

#

what he's asking for is an implementation of apple's solution of a native class that does that

#

but thats ios 7+

#

the discord client is ios 5+

#

that class does not exist, therefore, other solutions must be found

#
<img aria-label=":frcoal~2:" class="emoji" data-type="emoji" data-id="784338955759517696" alt=":frcoal~2:" draggable="false" src="https://cdn.discordapp.com/emojis/784338955759517696.webp?size=56">```
#

it seems thats also how discord does it's emojis!

#

in fact, it's EXACTLY how discord does it's emojis

#

if it's good enough for one of the headlining features of a multi million dollar company, it's good enough for me

#

and while yes, you aren't making a website per se in an iOS app

#

there is no reason to think you shouldn't use a bit of html to make rendering an element designed to be rendered in html easier

robust radish
#

nice. is your question solved then?

magic hazel
#

it wasn't my question

#

lol

robust radish
#

whats your question

magic hazel
#

i don't have one

#

the point was raised that using html for this would be "cursed"

#

i provided counter arguments

robust radish
#

ah ok my bad, i assumed you had a question

magic hazel
#

nah all g

gentle grove
#

imagine if you just did everything discord does when making software

magic hazel
#

true

#

but still

#

in this case

indigo kraken
#

The tweak is done. It’ll probably be released it on Chariz later today

#

(free)

slim bramble
#

based chariz user

indigo kraken
#

aight it’s submitted

north lance
# slim bramble based chariz user

On one hand it's not very userfriendly to have the popular tweaks on so many different repos but on the other hand competition is awesome. We've seen how a "monopoly" like Cydia lead to nothing. Definitely a Chariz fan even though their website isn't too great.

timid furnace
#

We have cross repo search (canister) these days, these days users are fine

#

Maybe it won't help for discovery but if it's something specific users can find it

quaint rain
#

Cydia wasn’t a repo, it was a package manager for repos like how Sileo is

#

The reason why people make tons of repos is because they are individually selling/distributing their own shit

#

With the intention of like BigBoss, Havoc, Chariz, etc to offer a centralized repo for HQ tweaks

gentle grove
hexed knot
#

Do people still make their own repos?

#

I remember it used to be the cool thing to have your own repo

quaint rain
#

Ones like ports where it wouldn’t be allowed on like havoc

#

A lot of people have their own repos, but they shove their big or free tweaks on a proper storefront like havoc/chariz

magic hazel
#

this commit supports ios 4.3+ and it supports using url's

#

you can embed links

magic hazel
#

registering fonts in uikit is such a pain

quaint rain
#

Is the forward chevron used for the back aswell?

#

Nvm

north lance
# quaint rain Cydia wasn’t a repo, it was a package manager for repos like how Sileo is

Yes, obviously.

But Cydia being this huge package manager was quite bad. Other package managers never had a chance or didn’t even start development. All while Cydia could just do the bare minimum and be a mess code wise. While the biggest alternative (RockApp) was bought by saurik.

I wanted to compare that same thing to repos where Havoc is kinda in the same position. Though then again, who wants to host a big repo platform nowadays with the amount of tweak releases.

lime pivot
lime pivot
north lance
velvet path
lime pivot
#

yeah, I agree, search feels a bit overdue

magic hazel
#

with the help of chatgpt and apple's documentation, i'm happy to say i've backported NSLayoutConstraint's anchors

#
import UIKit

// MARK: - Anchor Backport

class Anchor {
    weak var view: UIView?
    let attribute: NSLayoutAttribute

    init(view: UIView, attribute: NSLayoutAttribute) {
        self.view = view
        self.attribute = attribute
    }

    // constraint to another anchor
    func constraint(equalTo other: Anchor, multiplier: CGFloat = 1.0, constant: CGFloat = 0) -> NSLayoutConstraint {
        let constraint = NSLayoutConstraint(
            item: view!,
            attribute: attribute,
            relatedBy: .Equal,
            toItem: other.view,
            attribute: other.attribute,
            multiplier: multiplier,
            constant: constant
        )
        return constraint
    }

    // constraint to constant value
    func constraint(equalToConstant constant: CGFloat) -> NSLayoutConstraint {
        let constraint = NSLayoutConstraint(
            item: view!,
            attribute: attribute,
            relatedBy: .Equal,
            toItem: nil,
            attribute: .NotAnAttribute,
            multiplier: 1,
            constant: constant
        )
        return constraint
    }
}

// MARK: - UIView Anchor Properties

extension UIView {
    var leadingAnchor: Anchor { return Anchor(view: self, attribute: .Leading) }
    var trailingAnchor: Anchor { return Anchor(view: self, attribute: .Trailing) }
    var topAnchor: Anchor { return Anchor(view: self, attribute: .Top) }
    var bottomAnchor: Anchor { return Anchor(view: self, attribute: .Bottom) }
    var widthAnchor: Anchor { return Anchor(view: self, attribute: .Width) }
    var heightAnchor: Anchor { return Anchor(view: self, attribute: .Height) }
    var centerXAnchor: Anchor { return Anchor(view: self, attribute: .CenterX) }
    var centerYAnchor: Anchor { return Anchor(view: self, attribute: .CenterY) }
}

// MARK: - NSLayoutConstraint isActive Backport

private var activeConstraints = NSHashTable<NSLayoutConstraint>.weakObjects()

extension NSLayoutConstraint {
    var isActive: Bool {
        get {
            return activeConstraints.contains(self)
        }
        set {
            guard let firstView = firstItem as? UIView else { return }
            firstView.translatesAutoresizingMaskIntoConstraints = false
            if newValue {
                // add to superview if not already added
                if let superview = firstView.superview, !superview.constraints.contains(self) {
                    superview.addConstraint(self)
                }
                activeConstraints.add(self)
            } else {
                if let superview = firstView.superview {
                    superview.removeConstraint(self)
                }
                activeConstraints.remove(self)
            }
        }
    }

    // MARK: - Activate / Deactivate multiple constraints
    static func activate(constraints: [NSLayoutConstraint]) {
        for c in constraints { c.isActive = true }
    }

    static func deactivate(constraints: [NSLayoutConstraint]) {
        for c in constraints { c.isActive = false }
    }
}
lime pivot
#

ok that's really cool

#

it would be nice to have a kind of general backport library for UIKit features

#

particularly like stack views

magic hazel
#

oh thats already done

#

lmao

#

someone did that

#

OAStackView

#

It's pretty comprehensive

#

the syntax is basically identical

#

just make a typealias for UIStackview and OAStackview

#

and you're good to go

#
viewStack.addArrangedSubview(SpacerView.spacer())
        viewStack.addArrangedSubview(gameTitle)
        viewStack.addArrangedSubview(SpacerView.spacer())
        viewStack.addArrangedSubview(playButton)
        
        
        viewStack.axis = .Vertical
        viewStack.alignment = .Center
        viewStack.distribution = .FillEqually
        viewStack.translatesAutoresizingMaskIntoConstraints = false```
#

hmm

#

conflicting methods

#

ima try the ios 8 sdk

lime pivot
#

I'm sure most of these things can be drop-in replaced by open source libs

magic hazel
#

it's an excellent port, has some quirks but overall it's quite good

#

errr no

#

funnily enough nearly nothing backports apples syntax

#

it's always their own special syntax that has it's own documentation

#

usually via cocoapods installation

lime pivot
#

ugh why

magic hazel
#

i want 1 library that has apple syntax and you can literally just drop the folder into your project

#

boom

#

start writing modern swift and uikit

#

so far everything other t han OAStackview has been the work of me/chatgpt (chatgpt fixes all my errors bcus im too lazy)

lime pivot
#

actually kinda sad cocoapods is shutting down

magic hazel
#

tf

#

i mean

#

spm

lime pivot
#

yeah

magic hazel
#

better in literally every way

lime pivot
#

and spm uhhh… doesn't demand GitHub run an entire dedicated server for them for free, forever

#

at CocoaPods' peak they were pushing a ton of traffic to the one repo

magic hazel
#

WHAT

#

gh does that shit for free????

lime pivot
#

reluctantly

magic hazel
#

nah you're kidding this is microsoft

lime pivot
#

like what are they gonna do, break a critical part of the iOS dev supply chain

magic hazel
#

yes

#

they're microsoft

#

šŸ’€

lime pivot
#

it was pre-Microsoft it started

magic hazel
#

so?

#

it's owned by microsoft

#

why haven't they shut it down

#

they're bleeding money

lime pivot
#

the irony is Microsoft would themselves have depended on it during its heyday

magic hazel
#

lmao thats wild

#

anyways ima install the ios 8 sdk

#

i think theres issues here with the ios 9 one actually having the methods im replicateing

#

and although i could do like

#

jlayoutanchor

#

i'd much prefer like actual uikit

#

then again idk if i prefer having to manually install the ios 8 sdk

#

šŸ’€

#

and forcing every other user to also do it

#

yeah nah i have to rename

lime pivot
#

any way to do it with preprocessor macros?

#

probably not I think

#

I've only ever done it by checking swift version

magic hazel
#

nah nah i figured out a ay

#

typealiases

#

im already doing it with OAStackView

#

I can use UIStackView just fine

#

Even tho it exists in ios 9

#

bcus its not pointing to the actual class

#

its pointing to OAStackView

#

so ima just type alias everything

#

import UIKit

// MARK: - Internal Anchor Backport (safe names)
class JAnchor {
    weak var view: UIView?
    let attribute: NSLayoutAttribute

    init(view: UIView, attribute: NSLayoutAttribute) {
        self.view = view
        self.attribute = attribute
    }

    func constraint(equalTo other: JAnchor, multiplier: CGFloat = 1.0, constant: CGFloat = 0) -> NSLayoutConstraint {
        return NSLayoutConstraint(
            item: view!,
            attribute: attribute,
            relatedBy: .Equal,
            toItem: other.view,
            attribute: other.attribute,
            multiplier: multiplier,
            constant: constant
        )
    }

    func constraint(equalToConstant constant: CGFloat) -> NSLayoutConstraint {
        return NSLayoutConstraint(
            item: view!,
            attribute: attribute,
            relatedBy: .Equal,
            toItem: nil,
            attribute: .NotAnAttribute,
            multiplier: 1,
            constant: constant
        )
    }
}

// MARK: - UIView extension using safe internal anchors
extension UIView {
    var jLeadingAnchor: JAnchor { return JAnchor(view: self, attribute: .Leading) }
    var jTrailingAnchor: JAnchor { return JAnchor(view: self, attribute: .Trailing) }
    var jTopAnchor: JAnchor { return JAnchor(view: self, attribute: .Top) }
    var jBottomAnchor: JAnchor { return JAnchor(view: self, attribute: .Bottom) }
    var jWidthAnchor: JAnchor { return JAnchor(view: self, attribute: .Width) }
    var jHeightAnchor: JAnchor { return JAnchor(view: self, attribute: .Height) }
    var jCenterXAnchor: JAnchor { return JAnchor(view: self, attribute: .CenterX) }
    var jCenterYAnchor: JAnchor { return JAnchor(view: self, attribute: .CenterY) }
}

// MARK: - NSLayoutConstraint isActive Backport
private let activeConstraints: NSHashTable = NSHashTable(options: .WeakMemory)

extension NSLayoutConstraint {
    var jIsActive: Bool {
        get {
            return activeConstraints.containsObject(self)
        }
        set {
            guard let firstView = firstItem as? UIView else { return }
            firstView.translatesAutoresizingMaskIntoConstraints = false
            if newValue {
                if let superview = firstView.superview where !superview.constraints.contains(self) {
                    superview.addConstraint(self)
                }
                activeConstraints.addObject(self)
            } else {
                if let superview = firstView.superview {
                    superview.removeConstraint(self)
                }
                activeConstraints.removeObject(self)
            }
        }
    }

    // MARK: - Activate / Deactivate multiple constraints
    static func activate(constraints: [NSLayoutConstraint]) {
        for c in constraints { c.jIsActive = true }
    }

    static func deactivate(constraints: [NSLayoutConstraint]) {
        for c in constraints { c.jIsActive = false }
    }
}

// MARK: - Typealiases / Modern-looking names
extension UIView {
    var leadingAnchor: JAnchor { return jLeadingAnchor }
    var trailingAnchor: JAnchor { return jTrailingAnchor }
    var topAnchor: JAnchor { return jTopAnchor }
    var bottomAnchor: JAnchor { return jBottomAnchor }
    var widthAnchor: JAnchor { return jWidthAnchor }
    var heightAnchor: JAnchor { return jHeightAnchor }
    var centerXAnchor: JAnchor { return jCenterXAnchor }
    var centerYAnchor: JAnchor { return jCenterYAnchor }
}
#

ngl chatgpt did the typealiasing for me i aint retyping allat

#
NSLayoutConstraint.activate([
            playButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
            playButton.centerYAnchor.constraint(equalTo: view.centerYAnchor),
            playButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.25),
            playButton.heightAnchor.constraint(equalTo: playButton.widthAnchor)
            ])```

this is now valid code on ios 6
#

prolly will just use view.addconstraint bcus im used ot it

north lance
lime pivot
#

I'm hazy on it now, but I think I was pushing for a proper auth system not using udids back in like 2015. reason it ended up first appearing in Sileo is because well… star was the first person that listened

#

maybe one day I'll reveal the magic formula that's made Chariz device linking work in Cydia. idk why but something I threw together in a few hours thinking it was nothing special, has never been replicated, and I've had plenty of people ask

#

it's definitely not straightforward though. and it shouldn't be necessary for it to be like that, but anyway

#

it just sucked from my pov that there was a whole JS API and no chance of it being exposed to anyone except cydia.saurik.com

manic forum
#

@harsh junco hm

fading shell
manic forum
trail nimbus
#

anyone here know how i could properly inject a deb into an ipa but with ellekit instead of cydiasubstrate?

granite frigate
#

sideloadly?

trail nimbus
trail nimbus
# grim sparrow why

Because I heard cydiasubstrate is broken on 26 (or at least some headers idk) so I wanted to try with ellekit

grim sparrow
#

The stuff that you can do without a jailbreak will be fine, i.e. objc swizzling

#

modifying c functions is beyond the paygrade of a jailed ios device

#

or at least, without jit

trail nimbus
#

But like don’t apps crash when having tweaks injected with cydiasubstrate?

grim sparrow
#

@velvet path idk the context here whats up

light owl
#

@native dune Is it working

native dune
#

You need ellekit

trail nimbus
#

Yeah

trail nimbus
native dune
#

Idk how manually but feather uses ellekit

trail nimbus
#

Yeah that ik but to my knowledge that can’t directly export apps atm

#

And not worth it buying a cert just for that

grim sparrow
#

who is still using substrate

trail nimbus
#

Most tools that inject tweaks into ipas I believe

grim sparrow
#

have you got an example of an ipa that crashes?

#

im intrigued

sonic totem
#

Are you sure they’re not just renaming ElleKit to substrate?

trail nimbus
#

Idk

native dune
#

I would get you an ipa but I can't sign anything to test if it crashes lol

grim sparrow
#

because all it should be doing is substrate hooks

#

which are just compiler macros

native dune
#

idk but I know my substrate apps broke when updating to iOS 26 and my ellekit apps continued working

#

and other people had the same issue

pearl sail
#

Substrate finally dead

#

What an era

rocky oriole
# trail nimbus Idk

There is tool that does it with ellekit but it's made by a piracy developer

#

Filtered here too i believe

timid furnace
#

all you really need from ellekit is 1 dylib anyway

#

just rename it to whatever sideloadly or whatever expects

rocky oriole
#

yeah

slim bramble
#

Also I’m pretty sure only ellekit to works to hook c functions on recent iOS versions

sonic totem
#

Other injection libraries would work

#

The method of hooking C functions hasn’t really changed

magic hazel
#

aw man still no response on my modmail request

naive kraken
#

or rather, ellekits is more simple

sonic totem
#

What does it do that the others didn’t?

naive kraken
#

the others did some mmap stuff idk

sonic totem
#

Ah I see

#

I forgot about all page permissions stuff I was thinking entirely about the actual physical hook

#

But okay no wonder it’s changed lol

grim sparrow
#

thats still only with jit ents right?

sonic totem
#

Not necessarily entitlements

#

But yeah, you need to be debugged or have dynamic-codesigning

indigo kraken
light owl
#

@native dune Can you make the testflight app work bruh

naive kraken
#

other than that it's impossible to work due to apples bullshit

#

even the fact ellekit works is a miracle

#

it's super weird

#

you can do
exec dsc mapping -> read/write dsc mapping (vm_protect) -> exec dsc mapping (vm_protect) once, but if you try to do it again, it doesn't work

indigo kraken
#

i’ve been using a Dobby shim by @visual meadow he’d probably want to know this

magic hazel
#

ayyy

#

W

magic hazel
tepid nacelle
magic hazel
#

lmao i mean i used AI to format the code and fix any bugs but i wrote pretty much everything myself

#

i generally only use ai for debugging

#

so

#

idk

#

i mean its pretty basic code

#

its really just busy work

#

reimplementing newer function calls

#

I'm pretty proud of some stuff

#

Like my dispatch queue reimplementation

#

it functions nearly identical to the actual thing

#

took a while to get that working

wooden yarrow
#

ai code does not look like that

magic hazel
#

yeah idk lmao

#

i mean maybe the comments? then again i'm pretty shitty at comments and some of them mightve been left over from when i got some ai debugging

#

really i only needed debugging for uh

#

like timer and uibutton

#

timer was my first one tho

tepid nacelle
tepid nacelle
magic hazel
#

ai*

#

Ai fixed my errors

#

That’s about it

tepid nacelle
#

šŸ‘ļø

wooden yarrow
#

(see above)

#

so it's basically just macbooks with the N1 chip which is uhh

#

nothing special really

vivid dew
#

n

wooden yarrow
#

1

native dune
#

n

raven zephyr
#

1

light owl
#

@native dune

#

Is it working

native dune
#

Lol

tepid nacelle
#

n

harsh junco
#

1

sullen roost
#

What is the game.ios file in the ipa file?

#

How can I open it tho

rocky oriole
manic forum
#

finally, I have an excuse to use this system message thing

kind herald
#

wtf tweakreviewsdb shutting down

#

Why :(

manic forum
#

i'm surprised it lasted this long

#

also jailbreaking is dead, so