Post

Replies

Boosts

Views

Activity

Reply to NEFilterDataProvider method handleInboundData parameter readBytes, is this data encrypted?
readBytes is just Data, so you need to decode the Data into whatever you are expecting it to be. e.g. if you are expecting a string, try something like: /// I don't have your readBytes, so I'll make a dummy one... let readBytes = Data() /// Convert to the target class you are expecting (e.g. String) guard let string = String(data: readBytes, encoding: .utf8) else { print("Error: couldn't get String from readBytes") return } /// Success... print("string: \(string)") Does that answer your question?
Jan ’22
Reply to convert base64 string to image on SwiftUI
If I understand you correctly, you want to convert a base64 String to a SwiftUI Image. /// I don't have your base64-encoded String, so I'll make a dummy one... let sourceData = Data() let base64String = sourceData.base64EncodedString() /// Convert base64-encoded String to UIImage guard let stringData = Data(base64Encoded: base64String), let uiImage = UIImage(data: stringData) else { print("Error: couldn't create UIImage") return } /// Convert UIImage to SwiftUI Image let swiftUIImage = Image(uiImage: uiImage) Is that what you wanted to know?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to How to draw a line of shapes in swift
In SwiftUI... You can draw in a View, using a Path Path has methods (that you should find familiar) like: move(to:) addLine(to:) addCurve(to:control1:control2:) To get the rotation, you could then use the View modifier: rotationEffect(_:anchor:) You could draw this over another view using a ZStack, or by using the "overlay" View modifier
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’22
Reply to Issues building HikeView.swift (from SwiftUI Tutorial)
Perhaps there is a problem with your Hike.swift? Could you share the code for that? Or maybe... When you were adding the files to your project, did you check: Copy items if needed Add to targets {Landmarks} Test: Select the file "HikeView.swift" In the file Inspector... ...make sure "Target Membership" shows a tick by "Landmarks"
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22