Translation needed

Mac OSX specific forum
Wolfram
Enthusiast
Enthusiast
Posts: 567
Joined: Thu May 30, 2013 4:39 pm

Translation needed

Post by Wolfram »

Can someone translate these swift code to PB?

Code: Select all

    let views = ["view": view]; 
                let horizontalConstraints = NSLayoutConstraint.constraints(withVisualFormat: "H:|[view]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views)
                superview?.addConstraints(horizontalConstraints)
macOS Catalina 10.15.7
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Translation needed

Post by wilbert »

I'm not 100% sure but I think it should be something like this

Code: Select all

views = CocoaMessage(0, 0, "NSDictionary dictionaryWithObject:", view, "forKey:$", @"view")
horizontalConstraints = CocoaMessage(0, 0, "NSLayoutConstraint constraintsWithVisualFormat:$", @"H:[view]", "options:", 0, "metrics:", #nil, "views:", views)
CocoaMessage(0, superview, "addConstraints:", horizontalConstraints)
Windows (x64)
Raspberry Pi OS (Arm64)
Post Reply