This file contains 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
@available(iOS 15.0, *) | |
struct TwinkleView:View { | |
private func position(in proxy: GeometryProxy, sparkle:Sparkle) -> CGPoint { | |
let radius = min(proxy.size.width, proxy.size.height) / 2.0 | |
let drawnRadius = (radius - 5) * sparkle.position.x | |
let angle = Double.pi * 2.0 * sparkle.position.y | |
let x = proxy.size.width * 0.5 + drawnRadius * cos(angle) | |
let y = proxy.size.height * 0.5 + drawnRadius * sin(angle) |
This file contains 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
// Advanced SwiftUI Transitions | |
// https://swiftui-lab.com | |
// https://swiftui-lab.com/advanced-transitions | |
import SwiftUI | |
struct CrossEffectDemo: View { | |
let animationDuration: Double = 2 | |
let images = ["photo1", "photo2", "photo3", "photo4"] | |
@State private var idx = 0 |
This file contains 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
CFNETWORK_DIAGNOSTICS = 1 // NSURLSession debugging |
This file contains 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
Thanks to http://radex.io/watch/hyphenation/?utm_campaign=iOS%2BDev%2BWeekly&utm_source=iOS_Dev_Weekly_Issue_200 | |
extension WKInterfaceLabel { | |
func setHyphenatedText(text: String) { | |
let style = NSMutableParagraphStyle() | |
style.hyphenationFactor = 1 | |
let attributes = [NSParagraphStyleAttributeName: style] | |
setAttributedText(NSAttributedString(string: text, attributes: attributes)) | |
} |
This file contains 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
# Remove 64-bit build architecture from Pods targets | |
post_install do |installer| | |
installer.project.targets.each do |target| | |
target.build_configurations.each do |configuration| | |
target.build_settings(configuration.name)['ARCHS'] = '$(ARCHS_STANDARD_32_BIT)' | |
end | |
end | |
end |
This file contains 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
A good blog post and sample project is at: | |
https://github.com/kharrison/CodeExamples/tree/master/SelfSize | |
UITableViewController Methods: | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
self.tableView.rowHeight = UITableViewAutomaticDimension; |
This file contains 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
// The first two lines can be set in Interface builder | |
self.titleLabel.numberOfLines = 0; | |
self.titleLabel.lineBreakMode:NSLineBreakByWordWrapping; | |
[self.titleLabel setPreferredMaxLayoutWidth:self.frame.size.width-50]; | |
// Also in IB, set a constraint on the label so the height it >= the height of a single line |
NewerOlder