Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
82 changes: 82 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# options
--swiftversion 5.6
--self remove # redundantSelf
--importgrouping testable-bottom # sortedImports
--commas always # trailingCommas
--trimwhitespace always # trailingSpace
--indent 2 #indent
--ifdef no-indent #indent
--indentstrings true #indent
--wraparguments before-first # wrapArguments
--wrapparameters before-first # wrapArguments
--wrapcollections before-first # wrapArguments
--wrapconditions before-first # wrapArguments
--wrapreturntype if-multiline #wrapArguments
--closingparen same-line # wrapArguments
--wraptypealiases before-first # wrapArguments
--funcattributes prev-line # wrapAttributes
--typeattributes prev-line # wrapAttributes
--wrapternary before-operators # wrap
--structthreshold 20 # organizeDeclarations
--enumthreshold 20 # organizeDeclarations
--organizetypes class,struct,enum,extension,actor # organizeDeclarations
--extensionacl on-declarations # extensionAccessControl
--patternlet inline # hoistPatternLet
--redundanttype inferred # redundantType
--emptybraces spaced # emptyBraces
--operatorfunc spaced

# We recommend a max width of 100 but _strictly enforce_ a max width of 130
--maxwidth 130 # wrap

# file options
--exclude Package.swift

# rules
--rules anyObjectProtocol
--rules blankLinesBetweenScopes
--rules consecutiveSpaces
--rules consecutiveBlankLines
--rules duplicateImports
--rules extensionAccessControl
--rules hoistPatternLet
--rules indent
--rules markTypes
--rules organizeDeclarations
--rules redundantParens
--rules redundantReturn
--rules redundantSelf
--rules redundantType
--rules redundantPattern
--rules redundantGet
--rules redundantFileprivate
--rules redundantRawValues
--rules sortedImports
--rules sortDeclarations
--rules strongifiedSelf
--rules trailingCommas
--rules trailingSpace
--rules typeSugar
--rules wrap
--rules wrapMultilineStatementBraces
--rules wrapArguments
--rules wrapAttributes
--rules braces
--rules redundantClosure
--rules redundantInit
--rules redundantVoidReturnType
--rules unusedArguments
--rules spaceInsideBrackets
--rules spaceInsideBraces
--rules spaceAroundBraces
--rules spaceInsideParens
--rules spaceAroundParens
--rules enumNamespaces
--rules blockComments
--rules spaceAroundComments
--rules spaceInsideComments
--rules spaceAroundOperators
--rules blankLinesAtStartOfScope
--rules blankLinesAtEndOfScope
--rules emptyBraces
--rules andOperator
92 changes: 32 additions & 60 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,38 @@
disabled_rules:
- trailing_whitespace
- file_length
- line_length
- type_body_length
- identifier_name
- function_parameter_count
- switch_case_alignment
- orphaned_doc_comment
- inclusive_language
- multiple_closures_with_trailing_closure

opt_in_rules:
- force_unwrapping
- implicitly_unwrapped_optional
- empty_count
- empty_string
- extension_access_modifier
- closure_spacing
only_rules:
- colon
- fatal_error_message
- first_where
- toggle_bool
- unused_declaration
- modifier_order
- contains_over_first_not_nil
- convenience_type
- fallthrough
- unused_import
- unavailable_function
- strict_fileprivate
- explicit_init
- anyobject_protocol
- switch_case_on_newline
- contains_over_range_nil_comparison
- contains_over_filter_count
- contains_over_filter_is_empty
- empty_collection_literal
- flatmap_over_map_reduce
- no_space_in_method_call
- implicitly_unwrapped_optional
- legacy_cggeometry_functions
- legacy_constant
- legacy_constructor
- legacy_nsgeometry_functions
- operator_usage_whitespace
- return_arrow_whitespace
- trailing_newline
- unused_optional_binding
- vertical_whitespace
- void_return
- custom_rules

excluded:
- Tests
- Vendor
- Scripts
- fastlane
- "DerivedData/**/*"
- "**/.build"
- "**/Package.swift"

function_body_length: 120
type_name:
min_length: 3
max_length: 60
identifier_name:
min_length: 3
max_length: 60
cyclomatic_complexity: 30
large_tuple:
warning: 4
error: 5
implicitly_unwrapped_optional:
mode: all_except_iboutlets
- "**/.build"

colon:
flexible_right_spacing: false
apply_to_dictionaries: true
apply_to_dictionaries: false

indentation: 2

custom_rules:
no_objcMembers:
name: "@objcMembers"
regex: "@objcMembers"
message: "Explicitly use @objc on each member you want to expose to Objective-C"
severity: error
no_direct_standard_out_logs:
name: "Writing log messages directly to standard out is disallowed"
regex: "(\\bprint|\\bdebugPrint|\\bdump|Swift\\.print|Swift\\.debugPrint|Swift\\.dump)\\s*\\("
match_kinds:
- identifier
message: "Don't commit `print(…)`, `debugPrint(…)`, or `dump(…)` as they write to standard out in release. Either log to a dedicated logging system or silence this warning in debug-only scenarios explicitly using `// swiftlint:disable:next no_direct_standard_out_logs`"
severity: warning
80 changes: 40 additions & 40 deletions Example/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
/*
MIT License

Copyright (c) 2017-2019 MessageKit

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// MIT License
//
// Copyright (c) 2017-2019 MessageKit
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit

@UIApplicationMain
final internal class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

var window: UIWindow?
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let masterViewController = UINavigationController(rootViewController: LaunchViewController())
let splitViewController = UISplitViewController()
splitViewController.viewControllers = UIDevice.current.userInterfaceIdiom == .pad
? [
masterViewController,
UIViewController()
]
: [masterViewController]
splitViewController.preferredDisplayMode = .allVisible

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = splitViewController
window?.makeKeyAndVisible()

let masterViewController = UINavigationController(rootViewController: LaunchViewController())
let splitViewController = UISplitViewController()
splitViewController.viewControllers = UIDevice.current.userInterfaceIdiom == .pad ? [masterViewController, UIViewController()] : [masterViewController]
splitViewController.preferredDisplayMode = .allVisible

window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = splitViewController
window?.makeKeyAndVisible()

if UserDefaults.isFirstLaunch() {
// Enable Text Messages
UserDefaults.standard.set(true, forKey: "Text Messages")
}

return true
if UserDefaults.isFirstLaunch() {
// Enable Text Messages
UserDefaults.standard.set(true, forKey: "Text Messages")
}

return true
}
}
Loading