slidenumber: true autoscale: 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
| // https://github.com/apple/swift/blob/b0f5815d2b003df628b1bcfe94681fec489c9492/stdlib/public/Darwin/Foundation/JSONEncoder.swift#L153 | |
| func _convertToSnakeCase(_ stringKey: String) -> String { | |
| guard !stringKey.isEmpty else { return stringKey } | |
| var words : [Range<String.Index>] = [] | |
| // The general idea of this algorithm is to split words on transition from lower to upper case, then on transition of >1 upper case characters to lowercase | |
| // | |
| // myProperty -> my_property | |
| // myURLProperty -> my_url_property | |
| // |
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
| %{ | |
| number_of_generated = 5 | |
| }% | |
| public struct PrefixedArray<Element, RestElements> { | |
| public let prefix: Element | |
| public let rest: RestElements | |
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
| // | |
| // CallStackReporter.swift | |
| // DramaticCrash | |
| // | |
| // Copyright (c) 2018 Hironori Ichimiya <hiron@hironytic.com> | |
| // | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy | |
| // of this software and associated documentation files (the "Software"), to deal | |
| // in the Software without restriction, including without limitation the rights | |
| // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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
| import UIKit | |
| final class KeepingContentOffsetCollectionViewLayout : UICollectionViewFlowLayout { | |
| private var oldOffset: CGFloat? | |
| typealias Completion = () -> Void | |
| /// Perform passed closure with keeping current contentOffset. | |
| /// |
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
| protocol Animal { | |
| func foo() -> Int | |
| } | |
| struct Cat: Animal { | |
| var value: Int = 42 | |
| func foo() -> Int { return value } | |
| } | |
| func useAnimal(_ animal: Animal) -> Int { |
The iTunes API doesn't provide a way to grab artist images, but the iTunes website uses Open Graph meta tags, which embeds a meta tag with a property attribute value set to og:image. As it turns out, this seems to be the same image used in the iTunes artwork.
The URL structure is similar to the artworkUrl values returned by the API, but what concerns us here is the part I've indicated at the end of the URL.
http://is3.mzstatic.com/image/thumb/Music7/v4/68/68/41/68684190-833b-bfb4-5018-e5a2e6f69eb0/source/1200x630bf.jpg
└─ widthxheight
| 日時: | 2023-12-03 |
|---|---|
| 作: | voluntas |
| バージョン: | 2023.1 |
| url: | https://voluntas.github.io |
この記事が良いと思ったらこの記事に Star をお願いします