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 by Don Mag on 3/4/23. | |
// | |
import UIKit | |
class ContentSizeViewController: UIViewController, UIScrollViewDelegate { | |
let scrollView = UIScrollView() | |
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
class ViewController: UIViewController { | |
let infoLabel = UILabel() | |
let stack = UIStackView() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
view.backgroundColor = .systemYellow |
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
// | |
// SlowLabelViewController.swift | |
// | |
// Created by Don Mag on 12/14/22. | |
// | |
// Demonstrates how slow UILabel rendering when using High-Unicode strings | |
class SlowLabelViewController: UIViewController { | |
var lowAsciiStr: String = "" |
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
// assign table view controller custom class to: | |
// DonMagSampleTableViewController | |
// no cell Prototypesneeded | |
// no @IBOutlet or @IBAction connections needed | |
struct DonMagSampleDataStruct { | |
var color: UIColor = .white | |
var strings: [String] = [] | |
} |
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
class NewPopupTestViewController: UIViewController { | |
let popupView = PopupView() | |
let testMessages: [String] = [ | |
"Short Message", | |
"A Longer Message", | |
"A Sample Message that is long enough it will need to wrap onto multiple lines.", | |
] | |
var testIDX: Int = 0 |
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
// three different ways (among many) to implement a multi-colored progress- or slider-style view. | |
struct RecordingStep { | |
var color: UIColor = .black | |
var start: Float = 0 | |
var end: Float = 0 | |
// layer is used only with MultiLayerStepView | |
var layer: CALayer! | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="wEY-jX-xfc"> | |
<device id="retina4_7" orientation="portrait" appearance="light"/> | |
<dependencies> | |
<deployment identifier="iOS"/> | |
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/> | |
<capability name="Safe area layout guides" minToolsVersion="9.0"/> | |
<capability name="System colors in document resources" minToolsVersion="11.0"/> | |
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | |
</dependencies> |
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
// generate a PDF with | |
// a 6-inch vertical line crossed by a 6-inch horizontal line | |
// vertical and horizontal "1-inch hash" lines | |
// 6-, 4- and 2-inch diameter circles | |
// see app image here: https://imgur.com/a/O9dmB9M | |
import PDFKit | |
class ViewController: UIViewController { |
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
@IBDesignable | |
class IntrinsicHeightLabel: UILabel { | |
@IBInspectable | |
var h: CGFloat = 0 | |
override var intrinsicContentSize: CGSize { | |
let sz = super.intrinsicContentSize | |
if h == 0 { | |
return sz |
NewerOlder