Skip to content

Commit

Permalink
fix swift lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AnbalaganD committed Mar 12, 2024
1 parent ddb4723 commit 1b25ad4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: GitHub Action for SwiftLint
uses: norio-nomura/action-swiftlint@3.2.1
17 changes: 9 additions & 8 deletions LibraryManagement/Modules/Book/AddBookController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ final class AddBookController: UIViewController {
}

private func setupData(_ book: Book?) {
if let b = book {
bookNameTextField.text = b.name
authorTextFeild.text = b.author
stockTextFeild.text = "\(b.stock)"
descriptionTextView.text = b.description

guard let url = URL(string: b.coverImage), let imageData = try? Data(contentsOf: url) else {
coverImageView.image = UIImage(named: b.coverImage)
if let book {
bookNameTextField.text = book.name
authorTextFeild.text = book.author
stockTextFeild.text = "\(book.stock)"
descriptionTextView.text = book.description

guard let url = URL(string: book.coverImage), let imageData = try? Data(contentsOf: url) else {
coverImageView.image = UIImage(named: book.coverImage)
return
}
coverImageView.image = UIImage(data: imageData)
Expand Down Expand Up @@ -217,6 +217,7 @@ extension AddBookController: UIImagePickerControllerDelegate, UINavigationContro
}

extension AddBookController {
// swiftlint:disable:next function_body_length
private func setupView() {
view.backgroundColor = .systemBackground

Expand Down
14 changes: 5 additions & 9 deletions LibraryManagement/Modules/Book/BookListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ final class BookListController: UIViewController {
bookListTableView.reloadData()
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
Expand Down Expand Up @@ -266,7 +262,7 @@ extension BookListController: UITableViewDelegate, UITableViewDataSource {
.init(
style: .normal,
title: "Edit"
) {[weak self] action, view, handler in
) {[weak self] _, _, handler in
if let book = self?.bookList[indexPath.row] {
self?.editBook(book: book)
handler(true)
Expand All @@ -275,7 +271,7 @@ extension BookListController: UITableViewDelegate, UITableViewDataSource {
.init(
style: .destructive,
title: "Delete"
) {[weak self] action, view, handler in
) {[weak self] _, _, handler in
self?.confirmDelete(indexPath: indexPath)
handler(true)
}
Expand All @@ -291,16 +287,16 @@ extension BookListController: UITableViewDelegate, UITableViewDataSource {
UIContextMenuConfiguration(
identifier: nil,
previewProvider: nil
) { item in
) { _ in
UIMenu(
title: "Action",
children: [
UIAction(title: "Edit") {[weak self] action in
UIAction(title: "Edit") {[weak self] _ in
if let book = self?.bookList[indexPath.row] {
self?.editBook(book: book)
}
},
UIAction(title: "Delete", attributes: .destructive) {[weak self] action in
UIAction(title: "Delete", attributes: .destructive) {[weak self] _ in
if self?.bookList[indexPath.row] != nil {
self?.confirmDelete(indexPath: indexPath)
}
Expand Down

0 comments on commit 1b25ad4

Please sign in to comment.