Skip to content
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
46 changes: 46 additions & 0 deletions iOSBooks/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
- iOSBooksTests
included:
- iOSBooks
whitelist_rules:
- colon
- implicitly_unwrapped_optional
- empty_count
- force_cast
- force_try
- force_unwrapping
- first_where
- last_where
- legacy_random
- nslocalizedstring_key
- overridden_super_call
- private_over_fileprivate
- redundant_nil_coalescing
- redundant_optional_initialization
- redundant_string_enum_value
- sorted_first_last
- sorted_imports
- statement_position
colon: warning
empty_count: warning
force_cast: error
force_try: error
force_unwrapping: error
first_where: warning
implicitly_unwrapped_optional:
severity: error
last_where: warning
legacy_random: warning
nslocalizedstring_key: warning
overridden_super_call:
severity: warning
private_over_fileprivate:
severity: warning
redundant_nil_coalescing: warning
redundant_optional_initialization: warning
redundant_string_enum_value: warning
sorted_first_last: warning
sorted_imports: warning
statement_position:
severity: warning
1 change: 1 addition & 0 deletions iOSBooks/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target 'iOSBooks' do
# Pods for iOSBooks
pod 'PromiseKit'
pod 'Kingfisher', "~>5.1"
pod 'SwiftLint'

target 'iOSBooksTests' do
inherit! :search_paths
Expand Down
18 changes: 18 additions & 0 deletions iOSBooks/iOSBooks.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
0E3964D12314BB470093738B /* Frameworks */,
0E3964D22314BB470093738B /* Resources */,
29B8A3AC18D11FEF43C48244 /* [CP] Embed Pods Frameworks */,
74B9187D231CBF9800ADDEA4 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -473,6 +474,23 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iOSBooksTests/Pods-iOSBooksTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
74B9187D231CBF9800ADDEA4 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
B1160ABF1429D7BD27416220 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BookDetailViewController: UIViewController {

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
descriptionTextView?.scrollRangeToVisible(NSRange(location:0, length:0))
descriptionTextView?.scrollRangeToVisible(NSRange(location: 0, length: 0))
}

@objc func dismissScreen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class BooksListViewController: UIViewController {

// MARK: - View Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
setupCollectionView()
setupFavoritesFilterButton()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class BooksListViewModel: BooksListViewModelProtocol {
func cellForItem(inCollectionView collectionView: UICollectionView, atIndexPath indexPath: IndexPath) -> UICollectionViewCell {
let cell: BooksCell = collectionView.dequeueReusableCell(for: indexPath)
let book: Book?
var image: UIImage? = nil
var image: UIImage?
if showFavorites {
book = savedItems.books[indexPath.item].book
image = savedItems.images[indexPath.item]
Expand Down
2 changes: 1 addition & 1 deletion iOSBooks/iOSBooks/Data/Endpoints/BooksAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ enum BooksAPI: Endpoint {
}
}

var headers: [String : String]? {
var headers: [String: String]? {
switch self {
case .list:
return nil
Expand Down
2 changes: 1 addition & 1 deletion iOSBooks/iOSBooks/Data/Models/BooksList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

class BooksList: Codable {
let items: [Item]?
let totalItems : Int?
let totalItems: Int?

enum CodingKeys: String, CodingKey {
case items, totalItems
Expand Down
2 changes: 1 addition & 1 deletion iOSBooks/iOSBooks/Data/Models/Item.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
class Item: Codable {
var id: String?
var book: Book?
var salesInfo : SalesInfo?
var salesInfo: SalesInfo?

init() {
id = nil
Expand Down