From d6f985d93a0d263b5c319d641df4d6f57a4575e8 Mon Sep 17 00:00:00 2001 From: Florian Pichler Date: Mon, 26 Mar 2018 22:08:45 +0200 Subject: [PATCH] Add SwiftLint and update source code to match rules --- .editorconfig | 20 ++++++++ .swiftlint.yml | 8 +++ .vscode/settings.json | 3 ++ Audiobook Player.xcodeproj/project.pbxproj | 20 ++++++++ Audiobook Player/AppDelegate.swift | 46 ++++++++--------- Audiobook Player/ChaptersViewController.swift | 51 +++++++++---------- Audiobook Player/Extensions.swift | 42 ++++++++------- Audiobook Player/Info.plist | 2 +- Audiobook Player/MoreViewController.swift | 39 +++++++------- Audiobook Player/SettingsViewController.swift | 24 ++++----- Audiobook Player/SpeedViewController.swift | 41 ++++++++------- .../Audiobook_PlayerTests.swift | 8 ++- README.md | 30 +++++++---- 13 files changed, 196 insertions(+), 138 deletions(-) create mode 100644 .editorconfig create mode 100644 .swiftlint.yml create mode 100644 .vscode/settings.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..b74166ba7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 4 + +[{*.{yaml,yml},}] +indent_style = space +indent_size = 2 + +[*.{diff,md}] +trim_trailing_whitespace = false diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 000000000..b2e7327ba --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,8 @@ +excluded: + - Carthage +# line_length: 120 +disabled_rules: + - todo + - line_length + - type_name + - switch_case_alignment diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..3ffde7804 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.quickSuggestions": false +} \ No newline at end of file diff --git a/Audiobook Player.xcodeproj/project.pbxproj b/Audiobook Player.xcodeproj/project.pbxproj index 5f77ed8d3..6bbbd4d79 100644 --- a/Audiobook Player.xcodeproj/project.pbxproj +++ b/Audiobook Player.xcodeproj/project.pbxproj @@ -77,6 +77,9 @@ 41B2AC8D1D43CCE8005382A9 /* ChaptersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChaptersViewController.swift; sourceTree = ""; }; 41B2AC8F1D43CD2F005382A9 /* SpeedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpeedViewController.swift; sourceTree = ""; }; 41B2AC911D441627005382A9 /* MoreViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoreViewController.swift; sourceTree = ""; }; + C35BADE7206989E6007687C1 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; + C35BADE8206989E6007687C1 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + C35BADE9206989E6007687C1 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = ""; }; D367F7671FA2A6F000FEDB37 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -117,6 +120,9 @@ 418B6CEF1D2707F700F974FB = { isa = PBXGroup; children = ( + C35BADE8206989E6007687C1 /* README.md */, + C35BADE7206989E6007687C1 /* LICENSE */, + C35BADE9206989E6007687C1 /* .swiftlint.yml */, 418B6CFA1D2707F800F974FB /* Audiobook Player */, 418B6D111D2707F800F974FB /* Audiobook PlayerTests */, 418B6CF91D2707F800F974FB /* Products */, @@ -197,6 +203,7 @@ isa = PBXNativeTarget; buildConfigurationList = 418B6D171D2707F800F974FB /* Build configuration list for PBXNativeTarget "Audiobook Player" */; buildPhases = ( + C35BADEA20698A6D007687C1 /* ShellScript */, 418B6CF41D2707F800F974FB /* Sources */, 418B6CF51D2707F800F974FB /* Frameworks */, 418B6CF61D2707F800F974FB /* Resources */, @@ -333,6 +340,19 @@ shellPath = /bin/sh; shellScript = "/usr/local/bin/carthage copy-frameworks"; }; + C35BADEA20698A6D007687C1 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/Audiobook Player/AppDelegate.swift b/Audiobook Player/AppDelegate.swift index d16a5fc75..54a6df255 100644 --- a/Audiobook Player/AppDelegate.swift +++ b/Audiobook Player/AppDelegate.swift @@ -1,9 +1,9 @@ // -// AppDelegate.swift -// Audiobook Player +// AppDelegate.swift +// Audiobook Player // -// Created by Gianni Carlo on 7/1/16. -// Copyright © 2016 Tortuga Power. All rights reserved. +// Created by Gianni Carlo on 7/1/16. +// Copyright © 2016 Tortuga Power. All rights reserved. // import UIKit @@ -13,54 +13,54 @@ import Crashlytics @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate { - var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. Fabric.with([Crashlytics.self]) - let defaults:UserDefaults = UserDefaults.standard - + + let defaults: UserDefaults = UserDefaults.standard + // Perfrom first launch setup if !defaults.bool(forKey: UserDefaultsConstants.completedFirstLaunch) { // Set default settings defaults.set(true, forKey: UserDefaultsConstants.smartRewindEnabled) - defaults.set(true, forKey: UserDefaultsConstants.completedFirstLaunch) } UIApplication.shared.statusBarStyle = .lightContent - + try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback) - - //clean leftover sleep timer registry + + // clean leftover sleep timer registry UserDefaults.standard.set(nil, forKey: "sleep_timer") + return true } - + func application(_ app: UIApplication, - open url: URL, - options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { + open url: URL, + options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool { // This function is called when the app is opened with a audio file url, // like when receiving files through AirDrop - - let fmanager = FileManager.default + let fmanager = FileManager.default let filename = url.lastPathComponent let documentsURL = fmanager.urls(for: .documentDirectory, in: .userDomainMask).first! let destinationURL = documentsURL.appendingPathComponent(filename) - + // move file from Inbox to Document folder do { try fmanager.moveItem(at: url, to: destinationURL) - //In case the app was already running in background + // In case the app was already running in background NotificationCenter.default.post(name: Notification.Name.AudiobookPlayer.openURL, object: nil) } catch { // TODO: How should this case be handled? try! fmanager.removeItem(at: url) + return false } + return true } @@ -80,13 +80,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - + // Check if the app is on the PlayerViewController guard let navigationVC = UIApplication.shared.keyWindow?.rootViewController!, - navigationVC.childViewControllers.count > 1 else{ + navigationVC.childViewControllers.count > 1 else { + return } - + // Notify controller to see if it should ask for review NotificationCenter.default.post(name: Notification.Name.AudiobookPlayer.requestReview, object: nil) } @@ -94,5 +95,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } - } diff --git a/Audiobook Player/ChaptersViewController.swift b/Audiobook Player/ChaptersViewController.swift index 627baf0a7..5c3b535f2 100644 --- a/Audiobook Player/ChaptersViewController.swift +++ b/Audiobook Player/ChaptersViewController.swift @@ -1,9 +1,9 @@ // -// ChaptersViewController.swift -// Audiobook Player +// ChaptersViewController.swift +// Audiobook Player // -// Created by Gianni Carlo on 7/23/16. -// Copyright © 2016 Tortuga Power. All rights reserved. +// Created by Gianni Carlo on 7/23/16. +// Copyright © 2016 Tortuga Power. All rights reserved. // import UIKit @@ -11,39 +11,38 @@ import MediaPlayer import DeckTransition struct Chapter { - var title:String - var start:Int - var duration:Int - var index:Int + var title: String + var start: Int + var duration: Int + var index: Int } class ChaptersViewController: UIViewController { @IBOutlet weak var tableView: UITableView! @IBOutlet weak var vfxBackgroundView: UIVisualEffectView! - - var chapterArray:[Chapter]! - var currentChapter:Chapter! - + + var chapterArray: [Chapter]! + var currentChapter: Chapter! + override func viewDidLoad() { super.viewDidLoad() self.vfxBackgroundView.effect = UIBlurEffect(style: .light) - + self.currentChapter = PlayerManager.sharedInstance.currentChapter self.chapterArray = PlayerManager.sharedInstance.chapterArray - + self.tableView.tableFooterView = UIView() self.tableView.reloadData() } - - override var prefersStatusBarHidden : Bool { + + override var prefersStatusBarHidden: Bool { return true } - - override var preferredStatusBarUpdateAnimation : UIStatusBarAnimation { + + override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { return .slide } - - + @IBAction func didPressClose(_ sender: UIBarButtonItem) { self.dismiss(animated: true, completion: nil) } @@ -53,19 +52,20 @@ extension ChaptersViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return chapterArray.count } - + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "ChapterViewCell", for: indexPath) as! ChapterViewCell let chapter = self.chapterArray[indexPath.row] + cell.titleLabel.text = chapter.title cell.durationLabel.text = formatTime(chapter.start) cell.titleLabel.highlightedTextColor = UIColor.black cell.durationLabel.highlightedTextColor = UIColor.black - + if self.currentChapter.index == chapter.index { tableView.selectRow(at: indexPath, animated: true, scrollPosition: .top) } - + return cell } } @@ -73,6 +73,7 @@ extension ChaptersViewController: UITableViewDataSource { extension ChaptersViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let chapter = self.chapterArray[indexPath.row] + self.currentChapter = chapter self.performSegue(withIdentifier: "selectedChapterSegue", sender: self) } @@ -80,11 +81,10 @@ extension ChaptersViewController: UITableViewDelegate { /** * Temporal fix to stop dismiss when scrolling up on a long list - * View README.md -> https://github.com/HarshilShah/DeckTransition + * View README.md -> https:// github.com/HarshilShah/DeckTransition */ extension ChaptersViewController: UIScrollViewDelegate { func scrollViewDidScroll(_ scrollView: UIScrollView) { - if let delegate = transitioningDelegate as? DeckTransitioningDelegate { if scrollView.contentOffset.y > 0 { // Normal behaviour if the `scrollView` isn't scrolled to the top @@ -113,5 +113,4 @@ extension ChaptersViewController: UIScrollViewDelegate { class ChapterViewCell: UITableViewCell { @IBOutlet weak var titleLabel: UILabel! @IBOutlet weak var durationLabel: UILabel! - } diff --git a/Audiobook Player/Extensions.swift b/Audiobook Player/Extensions.swift index 8d55ada99..0f1c8e9cd 100644 --- a/Audiobook Player/Extensions.swift +++ b/Audiobook Player/Extensions.swift @@ -1,9 +1,9 @@ // -// Extensions.swift -// Audiobook Player +// Extensions.swift +// Audiobook Player // -// Created by Gianni Carlo on 3/10/17. -// Copyright © 2017 Tortuga Power. All rights reserved. +// Created by Gianni Carlo on 3/10/17. +// Copyright © 2017 Tortuga Power. All rights reserved. // import UIKit @@ -13,34 +13,34 @@ extension UIViewController { func showAlert(_ title: String?, message: String?, style: UIAlertControllerStyle) { let alert = UIAlertController(title: title, message: message, preferredStyle: style) let okButton = UIAlertAction(title: "Ok", style: .default, handler: nil) - + alert.addAction(okButton) - + alert.popoverPresentationController?.sourceView = self.view alert.popoverPresentationController?.sourceRect = CGRect(x: Double(self.view.bounds.size.width / 2.0), y: Double(self.view.bounds.size.height-45), width: 1.0, height: 1.0) - + self.present(alert, animated: true, completion: nil) } - - //utility function to transform seconds to format HH:MM:SS - func formatTime(_ time:Int) -> String { + + // utility function to transform seconds to format HH:MM:SS + func formatTime(_ time: Int) -> String { let hours = Int(time / 3600) - + let remaining = Float(time - (hours * 3600)) - + let minutes = Int(remaining / 60) - + let seconds = Int(remaining - Float(minutes * 60)) - - var formattedTime = String(format:"%02d:%02d", minutes, seconds) + + var formattedTime = String(format: "%02d:%02d", minutes, seconds) if hours > 0 { - formattedTime = String(format:"%02d:"+formattedTime, hours) + formattedTime = String(format: "%02d:" + formattedTime, hours) } - + return formattedTime } - - func presentModal(_ viewController:UIViewController, animated:Bool, completion: (() -> Swift.Void)? = nil){ + + func presentModal(_ viewController: UIViewController, animated: Bool, completion: (() -> Swift.Void)? = nil) { let transitionDelegate = DeckTransitioningDelegate() viewController.transitioningDelegate = transitionDelegate viewController.modalPresentationStyle = .custom @@ -49,13 +49,12 @@ extension UIViewController { } extension UINavigationController { - override open var preferredStatusBarStyle : UIStatusBarStyle { + override open var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } } extension Notification.Name { - public struct AudiobookPlayer { public static let openURL = Notification.Name(rawValue: "com.tortugapower.audiobookplayer.openurl") public static let requestReview = Notification.Name(rawValue: "com.tortugapower.audiobookplayer.requestreview") @@ -70,4 +69,3 @@ extension Notification.Name { public static let bookChange = Notification.Name(rawValue: "com.tortugapower.audiobookplayer.book.change") } } - diff --git a/Audiobook Player/Info.plist b/Audiobook Player/Info.plist index 080f554a5..50dac7daa 100644 --- a/Audiobook Player/Info.plist +++ b/Audiobook Player/Info.plist @@ -1,5 +1,5 @@ - + CFBundleDevelopmentRegion diff --git a/Audiobook Player/MoreViewController.swift b/Audiobook Player/MoreViewController.swift index 3b4968d76..bad5bdcf5 100644 --- a/Audiobook Player/MoreViewController.swift +++ b/Audiobook Player/MoreViewController.swift @@ -1,9 +1,9 @@ // -// MoreViewController.swift -// Audiobook Player +// MoreViewController.swift +// Audiobook Player // -// Created by Gianni Carlo on 7/23/16. -// Copyright © 2016 Tortuga Power. All rights reserved. +// Created by Gianni Carlo on 7/23/16. +// Copyright © 2016 Tortuga Power. All rights reserved. // import UIKit @@ -11,24 +11,24 @@ import UIKit class MoreViewController: UIViewController { @IBOutlet weak var tableView: UITableView! @IBOutlet weak var vfxBackgroundView: UIVisualEffectView! - - var selectedAction:MoreAction! - + + var selectedAction: MoreAction! + override func viewDidLoad() { super.viewDidLoad() + self.vfxBackgroundView.effect = UIBlurEffect(style: .light) self.tableView.tableFooterView = UIView() } - - override var prefersStatusBarHidden : Bool { + + override var prefersStatusBarHidden: Bool { return true } - - override var preferredStatusBarUpdateAnimation : UIStatusBarAnimation { + + override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { return .slide } - - + @IBAction func didPressClose(_ sender: UIBarButtonItem) { self.dismiss(animated: true, completion: nil) } @@ -38,14 +38,14 @@ extension MoreViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return MoreAction.actionNames.count } - + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "MoreViewCell", for: indexPath) let action = MoreAction(rawValue: indexPath.row) - + cell.textLabel?.text = action?.actionName() cell.textLabel?.highlightedTextColor = UIColor.black - + return cell } } @@ -53,6 +53,7 @@ extension MoreViewController: UITableViewDataSource { extension MoreViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let action = MoreAction(rawValue: indexPath.row) + self.selectedAction = action self.performSegue(withIdentifier: "selectedActionSegue", sender: self) } @@ -60,10 +61,10 @@ extension MoreViewController: UITableViewDelegate { enum MoreAction: Int { case jumpToStart, markFinished - + static let actionNames = [ - jumpToStart : "Jump To Start", markFinished : "Mark as Finished"] - + jumpToStart: "Jump To Start", markFinished: "Mark as Finished"] + func actionName() -> String { if let actionName = MoreAction.actionNames[self] { return actionName diff --git a/Audiobook Player/SettingsViewController.swift b/Audiobook Player/SettingsViewController.swift index 376fab735..0b0fdd969 100644 --- a/Audiobook Player/SettingsViewController.swift +++ b/Audiobook Player/SettingsViewController.swift @@ -16,11 +16,11 @@ class SettingsViewController: UITableViewController { @IBOutlet weak var globalSpeedSwitch: UISwitch! @IBOutlet weak var autoplaySwitch: UISwitch! - let defaults:UserDefaults = UserDefaults.standard - + let defaults: UserDefaults = UserDefaults.standard + override func viewDidLoad() { super.viewDidLoad() - + smartRewindSwitch.addTarget(self, action: #selector(self.rewindToggleDidChange), for: .valueChanged) boostVolumeSwitch.addTarget(self, action: #selector(self.boostVolumeToggleDidChange), for: .valueChanged) globalSpeedSwitch.addTarget(self, action: #selector(self.globalSpeedToggleDidChange), for: .valueChanged) @@ -28,7 +28,7 @@ class SettingsViewController: UITableViewController { //set colors self.navigationController?.navigationBar.barTintColor = UIColor.flatSkyBlue() - + //Set initial switch positions smartRewindSwitch.setOn(defaults.bool(forKey: UserDefaultsConstants.smartRewindEnabled), animated: false) boostVolumeSwitch.setOn(defaults.bool(forKey: UserDefaultsConstants.boostVolumeEnabled), animated: false) @@ -37,17 +37,17 @@ class SettingsViewController: UITableViewController { // FileManager } - - @objc func rewindToggleDidChange(){ - defaults.set(smartRewindSwitch.isOn, forKey:UserDefaultsConstants.smartRewindEnabled) + + @objc func rewindToggleDidChange() { + defaults.set(smartRewindSwitch.isOn, forKey: UserDefaultsConstants.smartRewindEnabled) } - @objc func boostVolumeToggleDidChange(){ - defaults.set(boostVolumeSwitch.isOn, forKey:UserDefaultsConstants.boostVolumeEnabled) + @objc func boostVolumeToggleDidChange() { + defaults.set(boostVolumeSwitch.isOn, forKey: UserDefaultsConstants.boostVolumeEnabled) } - @objc func globalSpeedToggleDidChange(){ - defaults.set(globalSpeedSwitch.isOn, forKey:UserDefaultsConstants.globalSpeedEnabled) + @objc func globalSpeedToggleDidChange() { + defaults.set(globalSpeedSwitch.isOn, forKey: UserDefaultsConstants.globalSpeedEnabled) } @objc func autoplayToggleDidChange(){ @@ -57,7 +57,7 @@ class SettingsViewController: UITableViewController { @IBAction func didPressClose(_ sender: UIBarButtonItem) { self.dismiss(animated: true, completion: nil) } - + //TODO: remove this once settings page is completed override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { //hide all options except smart rewind diff --git a/Audiobook Player/SpeedViewController.swift b/Audiobook Player/SpeedViewController.swift index 3350790ca..6b5330905 100644 --- a/Audiobook Player/SpeedViewController.swift +++ b/Audiobook Player/SpeedViewController.swift @@ -1,37 +1,36 @@ // -// SpeedViewController.swift -// Audiobook Player +// SpeedViewController.swift +// Audiobook Player // -// Created by Gianni Carlo on 7/23/16. -// Copyright © 2016 Tortuga Power. All rights reserved. +// Created by Gianni Carlo on 7/23/16. +// Copyright © 2016 Tortuga Power. All rights reserved. // import UIKit class SpeedViewController: UIViewController { - @IBOutlet weak var tableView: UITableView! @IBOutlet weak var vfxBackgroundView: UIVisualEffectView! - - var speedArray:[Float] = [0.75, 1, 1.25, 1.5, 1.75, 2.00, 2.25, 2.5] - var currentSpeed:Float! - + + var speedArray: [Float] = [0.75, 1, 1.25, 1.5, 1.75, 2.00, 2.25, 2.5] + var currentSpeed: Float! + override func viewDidLoad() { super.viewDidLoad() + self.vfxBackgroundView.effect = UIBlurEffect(style: .light) self.currentSpeed = PlayerManager.sharedInstance.currentSpeed self.tableView.tableFooterView = UIView() } - - override var prefersStatusBarHidden : Bool { + + override var prefersStatusBarHidden: Bool { return true } - - override var preferredStatusBarUpdateAnimation : UIStatusBarAnimation { + + override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { return .slide } - - + @IBAction func didPressClose(_ sender: UIBarButtonItem) { self.dismiss(animated: true, completion: nil) } @@ -41,24 +40,24 @@ extension SpeedViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.speedArray.count } - + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "SpeedViewCell", for: indexPath) let speed = self.speedArray[indexPath.row] - + cell.textLabel?.text = String(speed) cell.textLabel?.highlightedTextColor = UIColor.black - + if speed == self.currentSpeed { cell.accessoryType = .checkmark - }else{ + } else { cell.accessoryType = .none } - + if self.currentSpeed == speed { tableView.selectRow(at: indexPath, animated: true, scrollPosition: .top) } - + return cell } } diff --git a/Audiobook PlayerTests/Audiobook_PlayerTests.swift b/Audiobook PlayerTests/Audiobook_PlayerTests.swift index 1ef16b511..35f2be3fb 100644 --- a/Audiobook PlayerTests/Audiobook_PlayerTests.swift +++ b/Audiobook PlayerTests/Audiobook_PlayerTests.swift @@ -10,27 +10,25 @@ import XCTest @testable import Audiobook_Player class Audiobook_PlayerTests: XCTestCase { - override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } - + override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } - + func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } - + func testPerformanceExample() { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } - } diff --git a/README.md b/README.md index b2a0dfbde..070cbf491 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ # Audiobook-Player + Player made in Swift for your DRM-free audiobooks. Now available in the [Appstore!](https://itunes.apple.com/us/app/bookplayer-audio-book-player/id1138219998?ls=1&mt=8) - - + + + +## Features -# Features - Upload your DRM-free audiobooks to your phone via file sharing in iTunes - Control audio playback from the lock screen or the control center - Maintain progress of your audiobooks @@ -18,22 +20,31 @@ Player made in Swift for your DRM-free audiobooks. Now available in the [Appstor - Boost volume (Thanks [gpambrozio](https://github.com/gpambrozio)) - Support for remote events from headset buttons. -# Upcoming features +### Upcoming features + - Support for Playlists - iCloud integration to store users' playlist and books' url cloud reference - Implementation of AWS S3 integration to store books in the cloud - Stream books -# Contributing +## Contributing + Pull requests regarding upcoming features (or bugs) are welcomed. Any suggestion or bug please open up an issue 👍 -# Dependencies +## Dependencies + Managed with [Carthage](https://github.com/Carthage/Carthage) + - [Chameleon](https://github.com/ViccAlexander/Chameleon) for colors - [MBProgressHUD](https://github.com/jdg/MBProgressHUD) for loading wheels - [DeckTransition](https://github.com/HarshilShah/DeckTransition) for modal presentations (like music app) -# Credits +Managed with [Homebrew](https://brew.sh) +å +- [SwiftLint](https://github.com/realm/SwiftLint) + +## Credits + - Large Play image made by [Vectors Market](http://www.flaticon.com/authors/vectors-market) from [www.flaticon.com](http://www.flaticon.com) - Large Pause image made by [Vectors Market](http://www.flaticon.com/authors/vectors-market) from [www.flaticon.com](http://www.flaticon.com) - Skip time image made by [Vaadin](http://www.flaticon.com/authors/vaadin) from [www.flaticon.com](http://www.flaticon.com) @@ -46,5 +57,6 @@ Managed with [Carthage](https://github.com/Carthage/Carthage) - Three squares image made by [Vaadin](http://www.flaticon.com/authors/vaadin) from [www.flaticon.com](http://www.flaticon.com) - App icon and screenshot template generator from https://appicontemplate.com/ -# License -Licensed under [GNU GPL v. 3.0](https://opensource.org/licenses/GPL-3.0). See `LICENSE` for details. +## License + +See `LICENSE` for details.