From bbfbd32f34da625494f6b391340fdaf891c6923d Mon Sep 17 00:00:00 2001 From: Kwangmin Bae Date: Fri, 11 Jun 2021 00:04:46 +0900 Subject: [PATCH] Apply SwiftFormat (#44) * add .swiftFormat add Run script for swiftFormat * Remove some conditions --- .swiftformat | 18 +++++++++++ JellyfinPlayer.xcodeproj/project.pbxproj | 41 ++++++++++++++++++++++++ Scripts/SwiftFormat.sh | 6 ++++ 3 files changed, 65 insertions(+) create mode 100644 .swiftformat create mode 100755 Scripts/SwiftFormat.sh diff --git a/.swiftformat b/.swiftformat new file mode 100644 index 00000000..9cb225e2 --- /dev/null +++ b/.swiftformat @@ -0,0 +1,18 @@ +# version: 0.47.5 + +--indent 4 #indent +--self init-only # redundantSelf +--semicolons never # semicolons +--stripunusedargs closure-only # unusedArguments +--maxwidth 140 #wrap +--assetliterals visual-width #wrap +--wraparguments after-first # wrapArguments +--wrapparameters after-first # wrapArguments +--wrapcollections before-first # wrapArguments +--wrapconditions after-first # wrapArguments +--funcattributes prev-line # wrapAttributes +--typeattributes prev-line # wrapAttributes +--varattributes prev-line # wrapAttributes + +--enable isEmpty +--disable strongOutlets,yodaConditions \ No newline at end of file diff --git a/JellyfinPlayer.xcodeproj/project.pbxproj b/JellyfinPlayer.xcodeproj/project.pbxproj index 5b62592f..8f1e89f6 100644 --- a/JellyfinPlayer.xcodeproj/project.pbxproj +++ b/JellyfinPlayer.xcodeproj/project.pbxproj @@ -427,6 +427,7 @@ isa = PBXNativeTarget; buildConfigurationList = 535870712669D21700D05A09 /* Build configuration list for PBXNativeTarget "JellyfinPlayer tvOS" */; buildPhases = ( + 62F49E8926721894002F2064 /* SwiftFormat */, 5358705C2669D21600D05A09 /* Sources */, 5358705D2669D21600D05A09 /* Frameworks */, 5358705E2669D21600D05A09 /* Resources */, @@ -451,6 +452,7 @@ isa = PBXNativeTarget; buildConfigurationList = 5377CC1B263B596B003A4E83 /* Build configuration list for PBXNativeTarget "JellyfinPlayer iOS" */; buildPhases = ( + 62F49E8826721881002F2064 /* SwiftFormat */, 5377CBED263B596A003A4E83 /* Sources */, 5377CBEE263B596A003A4E83 /* Frameworks */, 5377CBEF263B596A003A4E83 /* Resources */, @@ -577,6 +579,45 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 62F49E8826721881002F2064 /* SwiftFormat */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = SwiftFormat; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$SRCROOT\"/Scripts/SwiftFormat.sh\n"; + }; + 62F49E8926721894002F2064 /* SwiftFormat */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = SwiftFormat; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$SRCROOT\"/Scripts/SwiftFormat.sh \n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 5358705C2669D21600D05A09 /* Sources */ = { isa = PBXSourcesBuildPhase; diff --git a/Scripts/SwiftFormat.sh b/Scripts/SwiftFormat.sh new file mode 100755 index 00000000..da3a0e2e --- /dev/null +++ b/Scripts/SwiftFormat.sh @@ -0,0 +1,6 @@ +# Type a script or drag a script file from your workspace to insert its path. +if which swiftformat >/dev/null; then + swiftformat . --lint --lenient +else + echo "warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat" +fi \ No newline at end of file