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
@IBSegueAction private func showPerson(coder: NSCoder, sender: Any?, segueIdentifier: String?) | |
working variants: | |
@IBSegueAction private func showPerson(coder: NSCoder) | |
@IBSegueAction private func showPerson(_ coder: NSCoder, sender: Any?, segueIdentifier: String?) | |
@IBSegueAction private func showPerson(_ coder: NSCoder) | |
@IBSegueAction private func showPerson(coder: NSCoder) |
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
expr -l Swift -- import UIKit | |
expr -l Swift -- let $ca = unsafeBitCast(0x6000004c1dc0, to: CALayer.self) | |
expr -l Swift -- print($ca.borderWidth) |
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
[/]{2}\h*(lazy|private|let|var|func|struct|class|enum|case) |
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
find . -type f -name '*.xib' | rev | cut -d '/' -f1 | rev | cut -d '.' -f1 |
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
git log --full-history -1 -- '*IdentifierTextField.swift' | |
usage examples: | |
- Find out in which commit a given file was deleted from project |
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 | |
@resultBuilder | |
struct SubviewBuilder { | |
static func buildEither(first component: UIView) -> UIView { | |
print(#function + "2") | |
return component | |
} | |
static func buildEither(second component: UIView) -> UIView { | |
print(#function + "1") |
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
// | |
// ViewController.swift | |
// pocUIViewBuilder | |
// | |
// Created by MaxAir on 26/05/2023. | |
// | |
import UIKit | |
@resultBuilder | |
struct SubviewBuilder { |
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
created_at: Sun, 11 Jun 2023 13:31:06 GMT, Xcode 15.0.0-beta | |
Swift-macros quick notes | |
Related videos: | |
- [WWDC23 What’s new in Swift](https://developer.apple.com/videos/play/wwdc2023/10164) | |
- [WWDC23 Write Swift macros](https://developer.apple.com/videos/play/wwdc2023/10166) | |
- [WWDC23 Expand on Swift macros](https://developer.apple.com/videos/play/wwdc2023/10167) | |
It looks like: |
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 | |
class ShapeView: UIView { | |
private var topTrapezoidPath: UIBezierPath! | |
private var bottomTrapezoidPath: UIBezierPath! | |
private var leftTrapezoidPath: UIBezierPath! | |
private var rightTrapezoidPath: UIBezierPath! | |
private var rectanglePath: UIBezierPath! | |
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
public static func generateImageOfLetterInRectangleOfSize( | |
letter: Character, | |
backgroundColor: UIColor, | |
letterColor: UIColor, | |
width: CGFloat, | |
height: CGFloat | |
) -> UIImage { | |
let size = CGSize(width: width, height: height) | |
let renderer = UIGraphicsImageRenderer(size: size) | |
let image = renderer.image { context in |