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
| // | |
| // ContentView.swift | |
| // Animations | |
| // | |
| // Created by Kevin Bayer on 4/5/21. | |
| // | |
| import SwiftUI | |
| struct ContentView: View { |
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 BaseCollectionViewCell: UICollectionViewCell, Identifiable { | |
| override init(frame: CGRect) { | |
| super.init(frame: .zero) | |
| setupViews() | |
| setupConstraints() | |
| } |
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
| // without turtle drawing a hexagon is math heavy and not trivial to modify | |
| let numberOfSides: CGFloat = 6 | |
| let radiusOuterCircle: CGFloat = bounds.width | |
| let sideLength = radiusOuterCircle / 2 | |
| let theta = (CGFloat.pi * 2) / numberOfSides | |
| let centerX = sideLength / 2 | |
| let centerY = sideLength / 2 | |
| let initialPoint = CGPoint(x: radiusOuterCircle * cos(2 * CGFloat.pi * 0/numberOfSides + theta) + centerX, y: radiusOuterCircle * sin(2 * CGFloat.pi * 0/numberOfSides + theta) + centerY) |
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
| [ | |
| { | |
| "il": "Adana", | |
| "plaka": 1, | |
| "ilceleri": [ | |
| "Aladağ", | |
| "Ceyhan", | |
| "Çukurova", | |
| "Feke", | |
| "İmamoğlu", |
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 "*.swift" -not -path "./Pods/*" -exec sed -i '' -e '1,/^import/{/^\/\/.*/d;}' -e '/./,$!d' {} \; |
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
| extension UIView { | |
| func calculatePreferredHeight(preferredWidth: CGFloat? = nil) -> CGFloat { | |
| let width = preferredWidth ?? frame.width | |
| let widthConstraint = NSLayoutConstraint.constraintsWithVisualFormat("H:[view(==\(width)@999)]", options: .allZeros, metrics: nil, views: ["view": self]) | |
| addConstraints(contraint) | |
| let height = systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height | |
| removeConstraints(constraint) | |
| return height | |
| } | |
| } |
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
| #!/usr/bin/env swift | |
| //FIRST: chmod +x localized2JSON.swift | |
| //USE: ./localize-strings2json.swift localizable.strings strings.json | |
| //TODO: error checking for parameters and files | |
| //TODO: --help -h | |
| //TODO: separate groups of string in dictionaries? | |
| import Foundation |
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
| - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{ | |
| [super setHighlighted:highlighted]; | |
| [self setNeedsDisplay]; | |
| if (animated) { | |
| [UIView transitionWithView:self duration:0.1 | |
| options:UIViewAnimationOptionTransitionCrossDissolve | |
| animations:^{ | |
| [self.layer displayIfNeeded]; | |
| } completion:nil]; | |
| } |