Skip to content

Instantly share code, notes, and snippets.

@atierian
Last active May 20, 2023 17:03
Show Gist options
  • Save atierian/9f11f55ebc5eb7c2dec912a41217337e to your computer and use it in GitHub Desktop.
Save atierian/9f11f55ebc5eb7c2dec912a41217337e to your computer and use it in GitHub Desktop.
#!/bin/bash
# Invoke from root project directory after running `amplify codegen models` to add `CaseIterable`
# conformance to all codegen'd enums
FILES="amplify/generated/models/*.swift"
for f in $FILES
do
echo "Processing $f file..."
awk '/public enum [^CodingKeys]/ {gsub($0, "extension " $3 " CaseIterable {}"); print "\n" $0}' $f >> $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment