Skip to content

Add SPM support for the Objective-C runtime (v27.1 / pod 3.27.1) - #1

Open
damian-kolasinski wants to merge 1 commit into
objc-v27.1from
spm-objc-3.27.1
Open

Add SPM support for the Objective-C runtime (v27.1 / pod 3.27.1)#1
damian-kolasinski wants to merge 1 commit into
objc-v27.1from
spm-objc-3.27.1

Conversation

@damian-kolasinski

Copy link
Copy Markdown

Summary

Adds Swift Package Manager support for the Protocol Buffers Objective-C runtime, so the KingsChat iOS app can consume it via SPM/Tuist instead of the CocoaPods Protobuf pod.

Version provenance

  • Base branch objc-v27.1 == upstream tag v27.1, which is exactly CocoaPods Protobuf 3.27.1 (Protobuf.podspec at that tag: s.version = '3.27.1', :tag => "v27.1").
  • No upstream source files are modified — the branch only adds Package.swift, spm/include/ shim headers, and spm/README.md.

What the manifest mirrors from the podspec

  • Sources: objectivec/*.m excluding GPBProtocolBuffers.m (umbrella implementation file; compiling it would duplicate symbols).
  • Public headers: objectivec/*.h + objectivec/google/protobuf/*.pbobjc.h, exposed via shims so both generated-code import spellings compile without defining GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS:
    • #import <Protobuf/GPBProtocolBuffers.h>
    • #import "GPBProtocolBuffers.h"
  • PrivacyInfo.xcprivacy bundled as a resource.
  • MRC: requires_arc = false-fno-objc-arc via cSettings.unsafeFlags.

Consumption — pin by revision

Because of unsafeFlags, SwiftPM rejects this package as a versioned dependency; consume it by revision:

.package(url: "https://github.com/appunite/protobuf.git", revision: "906b4e881c441bc63725c586d0229f2ead4bbf72")

Product/target name: Protobuf.

Validation

  • xcodebuild -scheme Protobuf -destination "generic/platform=iOS Simulator" build — BUILD SUCCEEDED; -fno-objc-arc confirmed in the compile response file.
  • Consumer smoke test package depending on this package: ObjC file using all four import spellings above plus <Protobuf/Any.pbobjc.h>, calling GPBTimestamp/GPBAny APIs — compiles and links.

https://claude.ai/code/session_01LTj6vGgu7NmTs7bjupWAGh

Based on v27.1 (== CocoaPods Protobuf 3.27.1). Adds Package.swift mirroring
Protobuf.podspec (sources objectivec/*.m minus the GPBProtocolBuffers.m
umbrella, MRC via -fno-objc-arc unsafeFlags, PrivacyInfo.xcprivacy resource)
plus spm/include shim headers so both framework-style and quoted imports
resolve for consumers. No upstream source files modified.

Claude-Session: https://claude.ai/code/session_01LTj6vGgu7NmTs7bjupWAGh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants