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 myCollectionView: UICollectionView? |
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 getStartOffset(for event: CalendarEvent) -> CGFloat { | |
return gridView.getOffsetForDate(date: event.startDate) | |
} | |
func getHeight(for event: CalendarEvent) -> CGFloat { | |
let height = gridView.getOffsetForDate(date: event.endDate) - gridView.getOffsetForDate(date: event.startDate) | |
return height > Sizes.minEventHeight ? height : Sizes.minEventHeight | |
} |
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 getOffsetForDate(date: Date) -> CGFloat { | |
// dayViewHeight being the height of the view that containts the hour label and the line separator | |
let components = Calendar.current.dateComponents([.minute, .hour], from: date) | |
let hourOffset = CGFloat(components.hour ?? 0) * (dayViewHeight + Sizes.gridLineSeparation) | |
let minuteOffset = ceilToPixelsAccuracy(CGFloat(components.minute ?? 0) / 60 * (dayViewHeight + Sizes.gridLineSeparation)) | |
return hourOffset + minuteOffset + ceilToPixelsAccuracy(dayViewHeight / 2) | |
} | |
// Function to ceil according to the scaling factor |
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
[...] | |
// Add observer in layoutSubviews() | |
pictureImageView.observe(\UIImageView.frame, options: [.new]) { [weak self] (_, _) in | |
self?.updateTextViewFrame() | |
} | |
[...] |
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
private func setupStrings(for speaker: Speaker) { | |
titleLabel.text = speaker.name | |
positionLabel.text = speaker.position | |
descriptionTextView.text = speaker.description | |
updateTextViewFrame() | |
} | |
private func updateTextViewFrame() { | |
contentView.layoutIfNeeded() |
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 keyboard = KeyboardObserver() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
keyboard.observe { [weak self] (event) -> Void in | |
guard let self = self else { return } | |
switch event.type { | |
case .willShow, .willHide, .willChangeFrame: | |
// React to the keyboard and adapt your UI |
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
// MARK: - Keyboard Insets | |
extension UIViewController { | |
internal func updateInsets(for event: KeyboardEvent, scrollView: UIScrollView?) { | |
guard let scrollView = scrollView else { return } | |
let newKeyboardFrame = event.keyboardFrameEnd | |
let duration = event.duration | |
let newKeyboardHeight = newKeyboardFrame.origin.y < UIScreen.main.bounds.height ? newKeyboardFrame.height : Sizes.zero |
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
"${SRCROOT}/Scripts/IconVersioning.sh" |
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
#!/bin/bash | |
# | |
# Helpers | |
# | |
function installImageMagick() { | |
brew install imagemagick ghostscript | |
} | |
# |
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
if [ "${CONFIGURATION}" != "ReleaseProduction" ]; then | |
IFS=$'\n' | |
git checkout -- `find "${SRCROOT}/${PRODUCT_NAME}" -name AppIcon.appiconset -type d` | |
fi |