GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Screenshot of Swift code: func hasSupplementaryViewAfter() -> Bool { let cellIndex = elements.firstIndex { $0.elementCategory == .cell } ?? .max return elements.enumerated().contains { idx, obj in idx > cellIndex && obj.elementCategory == .supplementaryView } } func hasSupplementaryViewBefore() -> Bool { let cellIndex = elements.firstIndex { $0.elementCategory == .cell } ?? .max return elements.enumerated().contains { idx, obj in idx < cellIndex && obj.elementCategory == .supplementaryView } } func hash(into hasher: inout Hasher) { for elem in elements { elem.hash(into: &hasher) } } override var description: String { "\(super.description) - \(elements.description)" }

Download link

https://media.hachyderm.io/media_attachments/files/113/811/109/660/543/744/original/cf655ce1a95f1c06.png

Notices where this attachment appears

  1. Embed this notice
    Paul Cantrell (inthehands@hachyderm.io)'s status on Sunday, 12-Jan-2025 03:21:59 JST Paul Cantrell Paul Cantrell
    in reply to

    @airspeedswift
    This kept kicking around in my head, so just for amusement, I wrote out the equivalent Swift, trying to stay as close to the original (no refactoring) while being idiomatically Swifty. (Caveat: untested code.) Original Objective-C is in the second screenshot for comparison.

    An interesting detail surfaces…

    In conversation about 4 months ago from hachyderm.io permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.