https://medium.com/@doitian/ckb-transaction-structure-578ee363e566
// | |
// DebugDevice.swift | |
// | |
// Copyright 2022 • Sidetrack Tech Limited | |
// | |
import Foundation | |
// This must be called on the main-thread. | |
var isDebugProfileInstalled: Bool { |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
VStack(spacing: 0) { | |
Color.green | |
Color.green | |
Color.green | |
Color.yellow | |
Color.orange |
import SwiftUI | |
import PlaygroundSupport | |
struct iPod: View { | |
var body: some View { | |
VStack(spacing: 40) { | |
Screen() | |
ClickWheel() | |
Spacer() | |
} |
// A fun little game written in SwiftUI | |
// Copyright (c) John Sundell 2020, MIT license. | |
// This is a hacky implementation written just for fun. | |
// It's only verified to work on iPhones in portrait mode. | |
import SwiftUI | |
final class GameController: ObservableObject { | |
@Published var plane = GameObject.plane() | |
@Published private(set) var clouds = [GameObject]() |
# Uncomment the next line to define a global platform for your project | |
# platform :ios, '9.0' | |
target '%TargetName%' do | |
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks | |
use_frameworks! | |
# Pods for %TargetName% | |
# pod 'FBSDKCoreKit' | |
end |
import UIKit | |
/// A validation rule for text input. | |
public enum TextValidationRule { | |
/// Any input is valid, including an empty string. | |
case noRestriction | |
/// The input must not be empty. | |
case nonEmpty | |
/// The enitre input must match a regular expression. A matching substring is not enough. | |
case regularExpression(NSRegularExpression) |
The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).
My take-aways are:
-
You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.
-
Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse
@objc protocol Refreshable | |
{ | |
/// The refresh control | |
var refreshControl: UIRefreshControl? { get set } | |
/// The table view | |
var tableView: UITableView! { get set } | |
/// the function to call when the user pulls down to refresh | |
@objc func handleRefresh(_ sender: Any); |
import Foundation | |
import UIKit | |
@IBDesignable | |
class UIPaddedLabel: UILabel { | |
@IBInspectable var topPadding: CGFloat = 0 { | |
didSet { | |
updatePadding() | |
} |