marmelroy / PhoneNumberKit

A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber.
MIT License
5.13k stars 817 forks source link

Won't build for Swift 6 #793

Closed jcbriones closed 2 months ago

jcbriones commented 2 months ago

Using Xcode 16 and Swift 6 throws a compile time error: concurrent perform isn't thread safe from what I remember the error was.

DispatchQueue.concurrentPerform(iterations: numberStrings.count) { index in
    let numberString = numberStrings[index]
    do {
        let phoneNumber = try self.parse(numberString, withRegion: region, ignoreType: ignoreType)
        buffer.baseAddress!.advanced(by: index).initialize(to: phoneNumber)
    } catch {
        buffer.baseAddress!.advanced(by: index).initialize(to: PhoneNumber.notPhoneNumber())
        hasError = true
    }
}

New Issue Checklist

Steps to reproduce

Download Xcode 16 beta 5 and run the plugin.

Expected result

No compile time errors

Actual result

Giving a compile time error

Environment

macOS 15.1, iOS 18.0 simulator, swift 6.

bguidolim commented 2 months ago

Hey @jcbriones

Please, don't get me wrong, but the New Issue Checklist exists for a reason.

[x] Updated PhoneNumberKit to the latest version = https://github.com/marmelroy/PhoneNumberKit/releases/tag/3.8.0 [x] I searched for existing GitHub issues = https://github.com/marmelroy/PhoneNumberKit/issues/790 and https://github.com/marmelroy/PhoneNumberKit/pull/791

Check the latest version and let me know if you are still facing the issue.