Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add swiftformat configuration file #194

Merged
merged 2 commits into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions Example/JJFloatingActionButton.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
1957C8C42012815000F1574B /* JJFloatingActionButtonAppearanceSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJFloatingActionButtonAppearanceSpec.swift; sourceTree = "<group>"; };
1957C8C7201283EF00F1574B /* JJActionItemAppearanceSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJActionItemAppearanceSpec.swift; sourceTree = "<group>"; };
1957C8C920128AD200F1574B /* JJFloatingActionButtonDelegateSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJFloatingActionButtonDelegateSpec.swift; sourceTree = "<group>"; };
198002BD220D85C100BCE849 /* .swiftformat */ = {isa = PBXFileReference; lastKnownFileType = text; name = .swiftformat; path = ../../.swiftformat; sourceTree = "<group>"; };
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 = "<group>"; };
198B66021FBAE904009A17F2 /* BasicsExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicsExampleViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -208,6 +209,7 @@
198B662D1FBAEE16009A17F2 /* .gitignore */,
19B10AC21FF7BDDD00D70C32 /* .jazzy.yaml */,
198B662E1FBAEE16009A17F2 /* .swift-version */,
198002BD220D85C100BCE849 /* .swiftformat */,
19E247EA1FD93525009A7BA1 /* .swiftlint.yml */,
19037F0D1FC2ED7B00138594 /* CHANGELOG.md */,
195637221FDA9EFB0003B8FF /* config.yml */,
Expand Down
58 changes: 29 additions & 29 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -65,7 +65,7 @@ begin
check_executable('swiftlint')
sh "swiftlint"
end

desc 'Lint podspec'
task :lint_podspec do
title 'Linting podspec'
Expand All @@ -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'
Expand All @@ -102,8 +102,8 @@ begin
update_gems
update_cocoapods
end


#-- Documentation ----------------------------------------------------------#

desc 'Generate documentation'
Expand All @@ -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'
Expand All @@ -155,8 +155,8 @@ begin
File.delete palette_path
end
end


#-- Release ----------------------------------------------------------------#

desc 'Release version'
Expand All @@ -170,26 +170,26 @@ 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"
repo = "jjochen/JJFloatingActionButton"
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}"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

10 changes: 4 additions & 6 deletions Sources/AnimationConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down