class XcconfigGenerator def initialize(brand_key) @brand_key = brand_key @platform = SolaraSettingsManager.instance.platform end def generate Solara.logger.start_step("Generate Brand.xcconfig for iOS") destination = IOSFilePathManager.instance.brand_xcconfig content = generate_xcconfig_content File.write(destination, content) Solara.logger.debug("🎉 Generated #{IOSFilePathManager.instance.brand_xcconfig}. Content below ⬇️") Solara.logger.debug("--------------\n#{content}--------------") Solara.logger.end_step("Generate Brand.xcconfig for iOS") end private def generate_xcconfig_content content = <<~XCCONFIG ASSETCATALOG_COMPILER_APPICON_NAME = Artifacts/AppIcon #{load_config.map { |key, value| "#{key.upcase} = #{value}" }.join("\n")} XCCONFIG case @platform when Platform::Flutter # "../Generated.xcconfig" is the config related to Flutter itself, we must include it here. <<~XCCONFIG #include "../Generated.xcconfig" #{content} XCCONFIG when Platform::IOS content else raise ArgumentError, "Invalid platform: #{@platform}" end end def load_config config_path = FilePath.ios_config(@brand_key) JSON.parse(File.read(config_path)) end end