Post

Replies

Boosts

Views

Activity

LLDB "unable to attach" on Xcode v10.1 (10B61)
I am running the most up to date version of Xcode (v10.1 (10B61)) on a High Sierra system (10.13.6 (17G10021)) and find that compiling for macOS will work, but not visually display in the sumulator. I get the LLDB message: "unable to attach". Advice online suggested submitting new security certificates, which I have done, but still the simulator will not show up, even though the code compiles.
0
0
359
Nov ’23
Xcode's implementation of Localisation is so odd
Localising my app I found the entire process quite un-swift like (i.e. unsafe and unintuitive) and was not the only one, even the great Paul Hudson also thought it a strange implementation. Following a tutorial by Andrii Halabuda (https://www.youtube.com/watch?v=_PBA20ZVk1A) relying on an Enum to reduce errors, I found that the strings needed in the "Localizable.strings" strings file could not be avoided. I have not tried localisation in SwiftUI, I see that it is different, is it easier i.e. can Plists and such be avoided ? Is there any word on deeper integration that is just more like a normal method ?
2
0
646
Nov ’23
Deeper SVG integration into Xcode ?
Exporting SVG (XML) data for something like a six sided shape (hexagon) requires a piecemeal approach and very specific string needed for the XML to be rendered correctly: svgData += "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n" svgData += "<svg width=\"\(viewWidth)\" height=\"\(viewHeight)\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n" But there is also the addition of the obligatory prefix "M", followed by co-ordinate date, the postfixed "Z" finishing with path and colour data: <path d=\"\(svgPathData)\" fill=\"\(randomColourSVG)\" /> \n The trouble I ran into was the all important middling section that contained the x/y path data for multiple sides shapes. Could this not simply be a method to pass through from UIBezierPath or CAShapeLayer so that Xcode does this for me, much like the convenience of .cgColor used after a UIColor ? Basically, is SVG likely to get deeper integration ?
0
0
304
Nov ’23
UIBezierPath shape positioning
The following function creates a hexagon shape but as I collect the six pieces of the shape to plot into SVG co-ordinates, the x/y data is not positioning them correctly: var positionX: CGFloat = 0 var positionY: CGFloat = 0 if isFirstShape == true { // ENSURE USER SATISFACTION WITH ONE SHAPE PLACED WHERE FINGER TAPS positionX = touchLocation.x positionY = touchLocation.y } else { positionX = CGFloat.random(in: touchLocation.x - 200...touchLocation.x + 200) positionY = CGFloat.random(in: touchLocation.y - 200...touchLocation.y + 200) } let randomLength: CGFloat = CGFloat.random(in: 100...150) let randomColour: UIColor = getRandomColor(withProbabilities: colorProbabilities) let rectangle : CGRect = CGRect(x: positionX, y: positionY, width: randomLength, height: randomLength) let cornerRadius: CGFloat = 10.0 // ROUNDING CORNER VALUE var angle : CGFloat = CGFloat(0.5) // ROTATE HEXAGON 90º let sides : Int = 6 let path = UIBezierPath() var svgPathData = "M" // SVG : PATH DATA (START) let theta : CGFloat = CGFloat(2.0 * Double.pi) / CGFloat(sides) let radius : CGFloat = (rectangle.width + cornerRadius - (cos(theta) * cornerRadius)) / 2.0 let center : CGPoint = CGPoint(x: rectangle.origin.x + rectangle.width / 2.0, y: rectangle.origin.y + rectangle.width / 2.0) // DETERMINE STARTING POINT FOR DRAWING ROUNDED CORNERS let corner : CGPoint = CGPoint(x: center.x + (radius - cornerRadius) * cos(angle), y: center.y + (radius - cornerRadius) * sin(angle)) // MOVE PATH TO NEW POSITION ACCOUNTING FOR THE ROUNDED CORNER ANGLE path.move(to: CGPoint(x: corner.x + cornerRadius * cos(angle + theta), y: corner.y + cornerRadius * sin(angle + theta))) // SVG : POSITIONING DATA svgPathData += " \(corner.x) \(corner.y)" for _ in 0..<sides { angle += theta // POINT ON THE CIRCUMFERENCE OF THE CIRCLE : DETERMINED BY THE ANGLE let corner = CGPoint(x: center.x + (radius - cornerRadius) * cos(angle), y: center.y + (radius - cornerRadius) * sin(angle)) // ONE OF SIX POINTS : DETERMINED BY RADIUS AND ANGLE let tip = CGPoint(x: center.x + radius * cos(angle), y: center.y + radius * sin(angle)) let start = CGPoint(x: corner.x + cornerRadius * cos(angle - theta), y: corner.y + cornerRadius * sin(angle - theta)) let end = CGPoint(x: corner.x + cornerRadius * cos(angle + theta), y: corner.y + cornerRadius * sin(angle + theta)) path.addLine(to: start) // CONTROL POINT : INFLUENCE THE SHAPE / DIRECTION OF CURVE path.addQuadCurve(to: end, controlPoint: tip) svgPathData += " \(corner.x) \(corner.y)" // SVG : POSITIONING DATA } path.close() let bounds = path.bounds // MOVE POINTS IN RELATION TO ORIGINAL RECTANGLE DATA let transform = CGAffineTransform(translationX: -bounds.origin.x + rectangle.origin.x / 2.0, y: -bounds.origin.y + rectangle.origin.y / 2.0) path.apply(transform) // CREATE UIView WITH CAShapeLayer let hexagon = UIView(frame: rectangle) let shapeLayer = CAShapeLayer() shapeLayer.path = path.cgPath shapeLayer.fillColor = randomColour.cgColor hexagon.layer.addSublayer(shapeLayer) // SVG : COLOUR DATA let randomColourRGBA = getRGBAComponents(randomColour) let randomColourSVG = toSVGString(red : randomColourRGBA.red, green : randomColourRGBA.green, blue : randomColourRGBA.blue, alpha : randomColourRGBA.alpha) // SVG : PATH DATA (END) svgPathData += " Z" let pathElement = "<path d=\"\(svgPathData)\" fill=\"\(randomColourSVG)\" /> \n" svgPathStrings.append(pathElement) addSubview(hexagon) I tried but it just distorted the corners: let centerX = (corner.x + tip.x + start.x + end.x) / 4.0 let centerY = (corner.y + tip.y + start.y + end.y) / 4.0
0
0
308
Nov ’23
Signing up process valid for Debit Card users in UK ?
UK based here and trying to sign up for a Connect account to upload my apps, but my payment keeps being declined. The options state that both Debit and Credit cards are accepted, so why am I unable to sign up ? My iPhone is still iOS 15 so I cannot download the developer app and still on Big Sur I cannot download the macOS version, ridiculous ! I don't know if signing up via Apple's Developer app would allow the payment to go through or not, but the web based version is not working for me. I have read on other threads that Debit Card users need to submit ID, I can't imagine why, but it's not clearly stated at the sign up process, so I cannot be sure.
2
0
1.1k
Mar ’24