marmelroy / PhoneNumberKit

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

Cannot find type 'PhoneNumberTextField' in scope & SPM wrong version #778

Closed soiferman closed 3 weeks ago

soiferman commented 3 months ago

The issue is "Cannot find type 'PhoneNumberTextField' in scope" in ViewController and PhoneNumbeKit version in SPM

When I add a library via spm, it says that version is 2.6.0

Screenshot 2024-06-09 at 19 48 21

but the documentation says that you need to specify 3.7.0, If I manually set 3.7.0, then error occurred -> PhoneNumberKit could not be resolved.

In the next page, specify the version resolving rule as "Up to Next Major" from "3.7.0"

Screenshot 2024-06-10 at 09 03 58

I could continue using 2.6.0, but the project won't build due to the error "Cannot find type 'PhoneNumberTextField' in scope" in ViewController. The issue appeared after I cleaned the project (cmd + k)

After watching Package.json, i noticed that in 2.6.0 there is "exclude: ["UI"]" line, which probably explains my mistake, but anyhow it worked before cleaning

package import PackageDescription

let package = Package(
    name: "PhoneNumberKit",
    products: [
        .library(name: "PhoneNumberKit", targets: ["PhoneNumberKit"])
    ],
    targets: [
        .target(name: "PhoneNumberKit", path: "PhoneNumberKit", exclude: ["UI"]),
        .testTarget(name: "PhoneNumberKitTests", dependencies: ["PhoneNumberKit"], path: "PhoneNumberKitTests")
    ])

I also noticed that there used to be PhoneNumberKit-Dynamic and PhoneNumberKit-Static link, now its not.

Screenshot 2024-06-09 at 20 02 24

Tried to create a new project - same problem Tried to delete "Package.resolved" at /Name.xcodeproj/project.xcworkspace/xcshareddata/swiftpm - doesn't help

Environment

Xcode - Version 15.4 (15F31d)

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.