Post

Replies

Boosts

Views

Activity

Main actor-isolated property can not be referenced
Hello I'm getting this error in my code and I don't know why. Can somebody explain this or point me at a help article. import UIKit var greeting = "Hello, playground" let imageView = UIImageView() imageView.image = UIImage(named: "image") Utils.getImageSize(view: imageView) class Utils { static func getImageSize(view imageView: UIImageView) { let image = imageView.image print("Image size = \(image?.size ?? CGSize.zero)") } } The error is as follows: Cheers Murray
1
0
76
15h
addSubview with bounds not working
I'm using Swift to display some text in the middle of the screen, but I'm doing this programmatically instead of using the layout designer. So I'm starting with my version of a UILabel: class GenericLabel: UILabel I'm then creating one of these objects: let label = GenericLabel(frame: CGRect.zero) label.processResponse(componentDictionary ) view.addSubview(label) The processResponse function will set the text value, the font, fontsize, and set the bounds for where the text should be displayed on the screen. Currently I'm just wanting to position the text in the centre of the screen. During this process I send some messages to the console, like my calculation of the width and height and the bounds value. The console includes this: GenericLabel: default = centrex and centrey Utils:setSize: parent view bounds = (0.0, 0.0, 402.0, 874.0) Utils:setSize: obj size = (85.33333333333333, 20.333333333333332) Utils.setSize: centrey myframe.origin.y = 426.8333333333333 Utils.setSize: centrex myframe.origin.x = 158.33333333333334 Utils:setSize: myframe is now set to = (158.33333333333334, 426.8333333333333, 85.33333333333333, 20.333333333333332) self.frame set to (158.33333333333334, 426.8333333333333, 85.33333333333333, 20.333333333333332) Finally I set this frame to my GenericLabel self.frame = Utils.setSize(["centrex":0, "centrey":0], for: self) // You can see this message in the console above print("self.frame set to \(self.frame)") Unfortunately the text appears at (0,0) as in this screenshot. Why is the frame not working? Is there some setting overriding the frame?
2
0
92
1w
NSURLErrorDomain Code=-1003 ... again!
This happens when trying to connect to my development web server. The app works fine when connecting to my production server. The production server has a certificate purchased from a CA. My development web server has a locally generated certificate (from mkcert). I have dragged and dropped the rootCA.pem onto the Simulator, although it doesn't indicate it has been loaded the certificate does appear in the Settings app and is checked to be trusted. I have enabled "App Sandbox" and "Outgoing connections (Client)". I have tested the URL from my local browser which is working fine. What am I missing?
6
0
622
1w
SWIFT: server certificate does NOT include an ID which matches the server name
I'm working on MBP OSX Ventura 13.5.2 I'm working with Swift 5 (Xcode 15.2) I have a local httpd configured with vhosts. I create my local certs using mkcert. When I visit the https://example site with Chrome the certificate is perfectly valid and there are no issues. When I try and contact the same site using a DataCallBack function to the URL I get the error "server certificate does NOT include an ID which matches the server name" In the log: Connection 1: default TLS Trust evaluation failed(-9807) Connection 1: TLS Trust encountered error 3:-9807 Connection 1: encountered error(3:-9807)
25
1
2.1k
Jul ’24