Skip to content

Unwanted diffs for Xcode 16+ #1018

@adellibovi

Description

@adellibovi

Background
Starting from Xcode 16, Xcode adds empty inputsPaths and outputPaths causing unwanted diffs when running a pod install.

Why This Is a Problem
These unnecessary entries make the project file needlessly complex and create unwanted diffs.

Solution
As a workaround:

pre_install do |install|
  Xcodeproj::Project::Object::PBXShellScriptBuildPhase.class_eval do
      def to_hash_as(method = :to_hash)
        hash_as = super
        included_keys_for_serialization_when_empty.each do |key|
          if hash_as[key].nil?
            hash_as[key] = []
          end
        end
        hash_as
      end

      def included_keys_for_serialization_when_empty
        %w(inputPaths outputPaths)
      end
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions