How To sysdiagnose on iOS:
- Hold volume up + volume down + power for 250 milliseconds.
- Wait (up to 5 minutes)
- Settings.app > Privacy > Analytics > Analytics Data
- Select the "sysdiagnose_" file and share via AirDrop to a Mac.
| import UIKit | |
| /// A UITextView subclass with placeholder text support. | |
| /// It uses another UILabel to show the placeholder, shown when text is empty. | |
| class PlaceholderTextView: UITextView { | |
| lazy var placeholderLabel: UILabel = { | |
| let label = UILabel() | |
| label.textColor = UIColor(white: 0.5, alpha: 0.85) | |
| label.backgroundColor = .clear |
How To sysdiagnose on iOS:
| // | |
| // SMRecurrenceRule.swift | |
| // Summit | |
| // | |
| // Created by Ben Winters on 8/27/17. | |
| // Copyright © 2017 Goals LLC. All rights reserved. | |
| // | |
| import EventKit | |
| import Foundation |
| // promise | |
| const sleep = (timeout, v) => new Promise(r => setTimeout(() => r(v), timeout)); | |
| // series to call | |
| const series = [() => sleep(1000, 1), () => sleep(1000, 2), () => sleep(1000, 3)]; | |
| // serialize | |
| const r = series | |
| .reduce( | |
| (m, p) => m.then(v => Promise.all([...v, p()])), | |
| Promise.resolve([]) |
| public static class ExampleViewHolder extends RecyclerView.ViewHolder | |
| implements View.OnClickListener { | |
| private int originalHeight = 0; | |
| private boolean isViewExpanded = false; | |
| private YourCustomView yourCustomView | |
| public ExampleViewHolder(View v) { | |
| super(v); | |
| v.setOnClickListener(this); |
| - (CGFloat)heightForAttributedString:(NSAttributedString *)text maxWidth:(CGFloat)maxWidth { | |
| if ([text isKindOfClass:[NSString class]] && !text.length) { | |
| // no text means no height | |
| return 0; | |
| } | |
| NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading; | |
| CGSize size = [text boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX) options:options context:nil].size; |