Skip to content

Instantly share code, notes, and snippets.

@J-Swift
Last active February 15, 2023 01:50
Show Gist options
  • Save J-Swift/f30b7aa92ac7ca1bee0b5df142d945ae to your computer and use it in GitHub Desktop.
Save J-Swift/f30b7aa92ac7ca1bee0b5df142d945ae to your computer and use it in GitHub Desktop.
Scratch pad of building maui net6.0-ios bindings with fat xcframeworks
#!/usr/bin/env bash
set -euo pipefail
readonly build_dir="build"
readonly output_dir="${build_dir}/Frameworks"
readonly target='getstream-swiftproxy'
main() {
rm -rf "${output_dir}"
xcodebuild archive \
-workspace "GetStream-iOS.xcworkspace" \
-scheme "${target}" \
-destination "generic/platform=iOS" \
-archivePath "${output_dir}/${target}-ios.xcarchive" \
ENABLE_BITCODE=NO SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
xcodebuild archive \
-workspace "GetStream-iOS.xcworkspace" \
-scheme "${target}" \
-destination "generic/platform=iOS Simulator" \
-archivePath "${output_dir}/${target}-sim.xcarchive" \
ENABLE_BITCODE=NO SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
# -debug-symbols #{@xchelper.xcarchive_dSYMs_path(index)}/#{@xchelper.framework}.dSYM" \
xcodebuild -create-xcframework \
-framework "${output_dir}/${target}-sim.xcarchive/Products/Library/Frameworks/getstream_swiftproxy.framework" \
-framework "${output_dir}/${target}-ios.xcarchive/Products/Library/Frameworks/getstream_swiftproxy.framework" \
-output "${output_dir}/getstream_swiftproxy.xcframework"
}
main
#!/usr/bin/env bash
set -euo pipefail
readonly script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# sharpie xcode -sdks
readonly target_sdk="iphoneos15.5"
readonly build_dir="${script_dir}/build"
readonly output_dir="${build_dir}/Bindings"
readonly target_framework_dir="${build_dir}/Frameworks/getstream_swiftproxy.xcframework/ios-arm64/getstream_swiftproxy.framework" \
main() {
sharpie bind \
-sdk "${target_sdk}" \
-output "${output_dir}/Original" \
-namespace GetStream \
-scope "${target_framework_dir}/Headers" \
"${target_framework_dir}/Headers/getstream_swiftproxy-Swift.h"
cp "${output_dir}"/Original/* "${output_dir}/"
}
main
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-ios</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsBindingProject>true</IsBindingProject>
<NoBindingEmbedding>true</NoBindingEmbedding>
<BindingPlatform>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</BindingPlatform>
</PropertyGroup>
<ItemGroup Condition="'$(BindingPlatform)' == 'ios'">
<ObjcBindingApiDefinition Include="..\GetStream-iOS\build\Bindings\ApiDefinitions.cs">
<Link>ApiDefinition.cs</Link>
</ObjcBindingApiDefinition>
<NativeReference Include="..\GetStream-iOS\build\Frameworks\getstream_swiftproxy.xcframework" Kind="Framework" />
<NativeReference Include="..\GetStream-iOS\Carthage\Build\StreamChat.xcframework" Kind="Framework" />
<NativeReference Include="..\GetStream-iOS\Carthage\Build\StreamChatUI.xcframework" Kind="Framework" />
</ItemGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment