Видеозаписи всех докладов
// | |
// Diagrams.swift | |
// DiagramsSample | |
// | |
// Created by Chris Eidhof on 16.12.19. | |
// Copyright © 2019 objc.io. All rights reserved. | |
// | |
import SwiftUI |
import SwiftUI | |
struct SizeKey: PreferenceKey { | |
static func reduce(value: inout CGSize?, nextValue: () -> CGSize?) { | |
value = value ?? nextValue() | |
} | |
} | |
struct ContentView: View { | |
@State var width: CGFloat? = nil | |
var body: some View { |
class TextField: UITextField { | |
override var textInputMode: UITextInputMode? { | |
return UITextInputMode.activeInputModes.first(where: { | |
$0.primaryLanguage?.contains("ru") == true | |
}) | |
} | |
} |
Function name | Condition | In playgrounds and -Onone builds (the default for Xcode's Debug configuration) |
In -O builds (the default for Xcode's Release configuration) |
In -Ounchecked builds |
---|---|---|---|---|
assert | 🔘 | 🔘 | ⚪ | ⚪ |
assertionFailure | ⚪ | 🔘 | ⚪ | ⚪ |
precondition | 🔘 | 🔘 | 🔘 | ⚪ |
preconditionFailure | ⚪ | 🔘 | 🔘 | ⚪ |
fatalError | ⚪ | 🔘 | 🔘 | 🔘 |
dispatchPrecondition | 🔘 | 🔘 | 🔘 | ⚪ |
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
/** | |
<#Короткое описание.#> | |
<#Длинное описание.#> | |
``` | |
<#Пример использования#> | |
``` | |
- Precondition: <#Предусловие.#> | |
- Warning: <#Предупреждение.#> |
/* | |
Erica Sadun, http://ericasadun.com | |
*/ | |
import Foundation | |
// -------------------------------------------------- | |
// MARK: Foundation Interop |
Greetings and salutations, NSHipsters!
As the year winds down, it's a tradition here at NSHipster to ask you, dear readers, to offer up your favorite tricks and tips from the past year as gifts to your fellow hipsters. With iOS 9, El Capitan, brand new watch- and tvOS's, and the open-sourcing of some minor Apple-related tech, there's bound to be lots to share.
Submit your favorite piece of Swift or @objc
trivia, helpful hints, unexpected discoveries, useful workarounds, useless fascinations, or anything else you found cool this year. Just comment below!
If you need inspiration, try [the list from last year][2015], or [from the year before][2014], or [from the year before that][2013].