Post

Replies

Boosts

Views

Created

How to capture unknown number of matches using RegexBuilder?
I know how to match unknown number of fields with using 'range' and '.regularExpression' option as shown below, but how do i do it with the new RegexBuilder or multi-line literal? func matches(for regex: String, in text: String) -> [String] { var result = [String]() var startIndex = text.startIndex let endIndex = text.endIndex while let range = text.range(of: regex, options: .regularExpression, range: startIndex ..< endIndex) { result.append(String(text[range])) startIndex = range.upperBound } return result }
1
0
628
Jul ’23
Can someone explain the RaycastResult calculation in the FacePainting app?
Hi, i downloaded the FacePainting app from here https://developer.apple.com/documentation/realitykit/creating_an_app_for_face-painting_in_ar but i don't understand the RaycastResult calculation like how to figure out the uv from the indices, can someone explain or annotate the steps, thanks.
Replies
0
Boosts
0
Views
537
Activity
Feb ’23
Does SwiftData support UIImage
Does SwiftData support UIImage as in CoreData specified here: https://www.swiftdevjournal.com/saving-images-in-core-data/ If it does, how to specify that in the @Model schema, especially using external storage to save the image in a separate file. Thanks.
Replies
3
Boosts
1
Views
2.8k
Activity
Jul ’23
How to capture unknown number of matches using RegexBuilder?
I know how to match unknown number of fields with using 'range' and '.regularExpression' option as shown below, but how do i do it with the new RegexBuilder or multi-line literal? func matches(for regex: String, in text: String) -> [String] { var result = [String]() var startIndex = text.startIndex let endIndex = text.endIndex while let range = text.range(of: regex, options: .regularExpression, range: startIndex ..< endIndex) { result.append(String(text[range])) startIndex = range.upperBound } return result }
Replies
1
Boosts
0
Views
628
Activity
Jul ’23