Skip to content

Conversation

@Physikbuddha
Copy link

This PR adds support for keyboard shortcuts and closes issue #26.

options: [.allowUserInteraction, .curveEaseInOut],
animations: {
self.hostingViewController?.view.layoutIfNeeded()
self.draggerView.backgroundColor = #colorLiteral(red: 0.0862745098, green: 0.0862745098, blue: 0.09411764706, alpha: 1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warum übergibst du die Farbe als Parameter?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changeHeight wird von expand() und collapse() aufgerufen, und beim Collapsen möchtest du den Dragger transparent machen, und beim Expandieren schwarz.
Die Aufgabe der Methode ist es, die Höhe zu ändern, nicht die Farbe zu bestimmen.
Farbbestimmung könnte man in eine eigene Methode auslagern.

collectionView.scrollToItem(at: newIndexPath, at: .centeredHorizontally, animated: true)
}

@objc func upvoteCurrentPost() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warum die ganzen actions auf dem DetailCollectionViewController und nicht auf dem DetailViewController?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weil du CollectionView verwendest, hast du immer mehrere aktive DetailViewController.
Daher werden die Shortcuts auf dem DetailCollectionViewController alleine abgefangen und dann an den jeweils aktiven DetailViewController weitergeleitet.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ansonsten würden alle aktiven DetailViewController den Shortcut bekommen und alle dann Blussi vergeben oder was auch immer.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ja stimmt, überlege grad wie man das noch optimieren könnte...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich wollte übrigens zuerst das Observer Pattern verwenden, aber das scheiterte aus dem gleichen Grund.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UIPageViewController löst wie gesagt diese ganzen Probleme. Da wird viewWillDisappear und der ganze andere Schnutzbutz gleich gefeuert, wenn du auf die nächste Seite wischst.

UICollectionView ist halt nicht für solche Fullscreensachen gedacht.

Aber trotzdem damit wirklich cool umgesetzt.

}

func upvotePost() {
self.viewModel.vote(.up)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self bitte nur wenn du es brauchst

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, mein Codestil ist: Immer this/self verwenden, wenn Klassenvariablen verwendet werden, da man so leichter erkennen kann, welche Variablen im Methodenscope sind, und welche nicht.

Hat mich teilweise beim Lesen des Codes oft suchen lassen, wo was steht.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dafür hast du code highlighting. Für mich ist das boilerplate... :D

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja ok, ändere ich.

Ich komme aus der C#-Welt, da ist das branchenübliche Best Practice.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erledigt.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bildschirmfoto 2021-05-24 um 22 08 22

Das ist übrigens Syntaxhighlighting bei meinem Xcode. Unterschiede zwischen Klassen- und Methodenvariablen sehe ich nicht, das ist alles weiß.

self.didFinishDownvote()
}

func favouritePost() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

American English bitte :D

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, ich wohne halt in Europa, daher nehm ich immer British English

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aber wenn schon favorite drunter :D

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erledigt.

[TASK] Change favourite to favorite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants