Repository navigation
Conversation
…d a Bundle.module nib lookup The tools-4.0 manifest compiles the sources in Swift 4 mode and ships no resources, so a SwiftPM build of Segmentio either fails on current toolchains or produces a BadgeWithCounterView that cannot find its nibs. - Package.swift: swift-tools-version 5.3, platforms iOS 10, the two badge xibs declared as processed resources. - BadgeWithCounterView: look the nib up in Bundle.module under SWIFT_PACKAGE, keep the CocoaPods resource-bundle lookup otherwise, and fall back to the programmatic view when the nib is missing instead of trapping. - README: Swift Package Manager installation section. Verified by building a consumer package against this manifest with Xcode 27.1 for the iOS simulator: Segmentio_Segmentio.bundle contains both compiled nibs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
Package.swiftis a tools-4.0 manifest. On current toolchains that means two things:BadgeWithCounterViewcreated from a SwiftPM build cannot findBadgeWithCounterViewBigSized.xib/BadgeWithCounterViewStandardSized.xib(the lookup goes through the CocoaPods resource bundle, which does not exist under SwiftPM).The README already advertises
swiftpm-compatible, so this closes the gap between the badge and the manifest.Solution
Package.swift:swift-tools-version:5.3,platforms: [.iOS(.v10)], and the two badge xibs declared as.processresources.BadgeWithCounterView.swift: under#if SWIFT_PACKAGEthe nib is loaded fromBundle.module; otherwise the existing CocoaPods resource-bundle lookup is kept. The view also falls back to the programmaticBadgeWithCounterView(frame: .zero)when the nib is not in the bundle instead of trapping.The podspec, the Carthage project and the Example app are untouched.
Verification
Built a throw-away consumer package that depends on this branch with Xcode 27.1 for the iOS simulator (
xcodebuild -scheme <consumer> -destination 'generic/platform=iOS Simulator'): the build succeeds andSegmentio_Segmentio.bundlecontains both compiled nibs. The same manifest and lookup are running in MotionBook (App Store), where the Segmentio demo shows the badge counters.