This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run {input, parameters} | |
set foldersList to {"DerivedData", "Archives", "iOS DeviceSupport", "CoreSimulator", "com.apple.dt.Xcode", "Backup"} | |
set choseFoldersToDelete to (choose from list foldersList with title "Pick Xcode folders to delete" with prompt "Automator will remove files from selected folders to Trash" default items "None" OK button name "Next" cancel button name "Cancel" with multiple selections allowed) | |
if choseFoldersToDelete is false then error number -128 | |
set theAlertText to "You've picked files from folders:" | |
set saveTID to text item delimiters | |
set text item delimiters to ", " | |
set theAlertMessage to choseFoldersToDelete as text | |
set text item delimiters to saveTID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class Spinner { | |
fileprivate static var activityIndicator: UIActivityIndicatorView? | |
fileprivate static var style: UIActivityIndicatorViewStyle = .whiteLarge | |
fileprivate static var baseBackColor = UIColor(white: 0, alpha: 0.6) | |
fileprivate static var baseColor = UIColor.white | |
/** | |
Add spinner to `UIView` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Spinner.swift | |
// | |
// Created by Michał Majchrzycki on 28.03.2018. | |
// Copyright © 2018 Prograils.com. All rights reserved. | |
// Check whole tutorial at: https://prograils.com/posts/reusable-activity-indicator-with-swift | |
import UIKit | |
open class Spinner { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(true) | |
self.calendarArray = getCalendar().arrayOfDates() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) { | |
if calendarCollectionView == scrollView && !decelerate { | |
setSelectedItemFromScrollView(scrollView) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func setSelectedItemFromScrollView(_ scrollView: UIScrollView) { | |
if calendarCollectionView == scrollView { | |
let center = CGPoint(x: scrollView.center.x + scrollView.contentOffset.x, y: scrollView.center.y + scrollView.contentOffset.y) | |
let index = calendarCollectionView.indexPathForItem(at: center) | |
if index != nil { | |
calendarCollectionView.scrollToItem(at: index!, at: .centeredHorizontally, animated: true) | |
self.calendarCollectionView.selectItem(at: index, animated: false, scrollPosition: []) | |
self.collectionView(self.calendarCollectionView, didSelectItemAt: index!) | |
self.selectedDate = (index?.row)! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { | |
if calendarCollectionView == scrollView { | |
setSelectedItemFromScrollView(scrollView) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let centeredIndexPath = IndexPath.init(item: selectedDate, section: 0) | |
collectionView.scrollToItem(at: centeredIndexPath, at: .centeredHorizontally, animated: true) | |
if indexPath == centeredIndexPath { | |
collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.selectedDateLabel.text = self.calendarArray?[indexPath.row] as? String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override var isSelected: Bool { | |
didSet { | |
if isSelected { | |
dateLabel!.textColor = UIColor.green | |
dateLabel.font = UIFont.boldSystemFont(ofSize: 14) | |
} else { | |
dateLabel!.textColor = UIColor.darkText | |
dateLabel.font = UIFont.systemFont(ofSize: 14) | |
} | |
} |
NewerOlder