PureBasic Forum
https://www.purebasic.fr/english/

Translation needed
https://www.purebasic.fr/english/viewtopic.php?f=19&t=73415
Page 1 of 1

Author:  Wolfram [ Sat Aug 17, 2019 11:03 am ]
Post subject:  Translation needed

Can someone translate these swift code to PB?
Code:
    let views = ["view": view];
                let horizontalConstraints = NSLayoutConstraint.constraints(withVisualFormat: "H:|[view]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views)
                superview?.addConstraints(horizontalConstraints)

Author:  wilbert [ Sat Aug 17, 2019 12:40 pm ]
Post subject:  Re: Translation needed

I'm not 100% sure but I think it should be something like this
Code:
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)

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/