diff --git a/.swiftformat b/.swiftformat new file mode 100644 index 00000000..5ca01066 --- /dev/null +++ b/.swiftformat @@ -0,0 +1,33 @@ +--allman false +--binarygrouping none +--closingparen balanced +--commas always +--comments indent +--decimalgrouping none +--disable redundantFileprivate, redundantObjc +--elseposition same-line +--empty void +--exclude Example/Pods, Package.swift +--exponentcase lowercase +--exponentgrouping disabled +--fractiongrouping disabled +--header ignore +--hexgrouping none +--hexliteralcase uppercase +--ifdef indent +--importgrouping alphabetized +--indent 4 +--indentcase false +--linebreaks lf +--octalgrouping none +--operatorfunc spaced +--patternlet hoist +--ranges spaced +--self remove +--selfrequired +--semicolons inline +--stripunusedargs always +--swiftversion 4.2 +--trimwhitespace always +--wraparguments after-first +--wrapcollections preserve diff --git a/Example/JJFloatingActionButton.xcodeproj/project.pbxproj b/Example/JJFloatingActionButton.xcodeproj/project.pbxproj index 4b540751..b55f8bbe 100644 --- a/Example/JJFloatingActionButton.xcodeproj/project.pbxproj +++ b/Example/JJFloatingActionButton.xcodeproj/project.pbxproj @@ -63,6 +63,7 @@ 1957C8C42012815000F1574B /* JJFloatingActionButtonAppearanceSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJFloatingActionButtonAppearanceSpec.swift; sourceTree = ""; }; 1957C8C7201283EF00F1574B /* JJActionItemAppearanceSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJActionItemAppearanceSpec.swift; sourceTree = ""; }; 1957C8C920128AD200F1574B /* JJFloatingActionButtonDelegateSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJFloatingActionButtonDelegateSpec.swift; sourceTree = ""; }; + 198002BD220D85C100BCE849 /* .swiftformat */ = {isa = PBXFileReference; lastKnownFileType = text; name = .swiftformat; path = ../../.swiftformat; sourceTree = ""; }; 198B65FD1FBAE904009A17F2 /* JJFloatingActionButton_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JJFloatingActionButton_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 198B66001FBAE904009A17F2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 198B66021FBAE904009A17F2 /* BasicsExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicsExampleViewController.swift; sourceTree = ""; }; @@ -208,6 +209,7 @@ 198B662D1FBAEE16009A17F2 /* .gitignore */, 19B10AC21FF7BDDD00D70C32 /* .jazzy.yaml */, 198B662E1FBAEE16009A17F2 /* .swift-version */, + 198002BD220D85C100BCE849 /* .swiftformat */, 19E247EA1FD93525009A7BA1 /* .swiftlint.yml */, 19037F0D1FC2ED7B00138594 /* CHANGELOG.md */, 195637221FDA9EFB0003B8FF /* config.yml */, diff --git a/Rakefile b/Rakefile index a8a913af..5c0e65ec 100644 --- a/Rakefile +++ b/Rakefile @@ -44,13 +44,13 @@ begin task :test do xcodebuild_test "platform=iOS Simulator,name=iPhone X" end - + desc 'Run tests for DESTINATION env' task :test_destination do Rake::Task[:print_debug_info].invoke xcodebuild_test ENV['DESTINATION'] end - + desc 'Print debug info' task :print_debug_info do title 'Debug info' @@ -65,7 +65,7 @@ begin check_executable('swiftlint') sh "swiftlint" end - + desc 'Lint podspec' task :lint_podspec do title 'Linting podspec' @@ -79,7 +79,7 @@ begin task :format do title 'Formating code' check_executable('swiftformat') - sh "swiftformat Example/Tests Example/JJFloatingActionButton Sources" + sh "swiftformat ." end desc 'Format and lint code' @@ -102,8 +102,8 @@ begin update_gems update_cocoapods end - - + + #-- Documentation ----------------------------------------------------------# desc 'Generate documentation' @@ -127,24 +127,24 @@ begin #-- Record Video -----------------------------------------------------------# - + desc 'Record video of booted simulator and convert to gif' task :record_gif do Rake::Task[:record_gif_with_name].invoke 'JJFloatingActionButton' end - + desc 'Record video of booted simulator and convert to gif with given name' task :record_gif_with_name, :name do |task, args| title 'Recording video' check_executable('ffmpeg') mov_path="./Images/#{args.name}.mov" - + trap('SIGINT') { puts } %x{xcrun simctl io booted recordVideo #{mov_path}} - + title 'Converting to gif' - + gif_path="./Images/#{args.name}.gif" palette_path='./Images/palette.png' filters='fps=30,setpts=1*PTS,scale=250:-1:flags=lanczos' @@ -155,8 +155,8 @@ begin File.delete palette_path end end - - + + #-- Release ----------------------------------------------------------------# desc 'Release version' @@ -170,13 +170,13 @@ begin create_release_branch_and_commit args.version open_pull_request args.version end - + desc 'Push podspec' task :push_podspec do title "Pushing podspec" sh 'bundle exec pod trunk push' end - + desc 'Create release on github' task :create_github_release do title "Creating release on github" @@ -184,12 +184,12 @@ begin version = version_from_podspec body = changelog_for_version version options = { - :name => version, + :name => version, :body => body, :draft => false, :prerelease => false } - + puts "repo: #{repo}" puts "version: #{version}" puts "body: \n#{body}" @@ -198,25 +198,25 @@ begin release = client.create_release repo, version, options puts "#{release.name} created." end - + desc 'Update github releases' task :update_github_releases do title "Updating releases on github" repo = "jjochen/JJFloatingActionButton" - + client = Octokit::Client.new :access_token => ENV['JJ_GITHUB_TOKEN'] client.releases(repo).each do |release| puts - + url = release.url puts "url: #{url}" - + version = release.tag_name puts "version: #{version}" - + body = changelog_for_version version puts "body: \n#{body}" - + options = { :name => version, :body => body @@ -324,7 +324,7 @@ def generate_changelog(version) sh "github_changelog_generator --future-release #{version}" else sh "github_changelog_generator" - end + end end def generate_documentation @@ -401,25 +401,25 @@ end def open_pull_request(version) title "Opening pull request" check_parameter(version) - + repo = "jjochen/JJFloatingActionButton" base = "master" release_branch = "release/#{version}" title = "Release #{version}" - + puts "repo: #{repo}" puts "base: #{base}" puts "head: #{release_branch}" client = Octokit::Client.new :access_token => ENV['JJ_GITHUB_TOKEN'] - + pull_request = client.create_pull_request repo, base, release_branch, title puts "#{pull_request.title} created." puts pull_request.html_url - + client.add_labels_to_an_issue repo, pull_request.number, ['release'] puts "release label added." - + sh "open #{pull_request.html_url}" end diff --git a/Sources/AnimationConfiguration.swift b/Sources/AnimationConfiguration.swift index 60bcb3c1..650f9e48 100644 --- a/Sources/AnimationConfiguration.swift +++ b/Sources/AnimationConfiguration.swift @@ -344,12 +344,10 @@ import Foundation /// /// - Returns: An initialized item layout object. /// - @objc public init(prepare: @escaping ( - _ item: JJActionItem, - _ index: Int, - _ numberOfItems: Int, - _ actionButton: JJFloatingActionButton - ) -> Void) { + @objc public init(prepare: @escaping (_ item: JJActionItem, + _ index: Int, + _ numberOfItems: Int, + _ actionButton: JJFloatingActionButton) -> Void) { self.prepare = prepare }