Parses the Accept-Language
header's value in an array of language directives.
const acceptLanguageValue = 'pt-BR, en;q=0.9, fr;q=0.8, it;q=0.7, *;q=0.5'
Allow to obtain match responses of given media query list items.
This hook relies on window.matchMedia
to provide precise updates when some media query matches or not its requirements. It will also handle and dispose event listeners properly and avoid uncessary re-renders.
Allows to store values in memory, powered by system NSCache (but for value types too).
The Cache
class is full based in a John Sundell tutorial (check out at See Also section).
Also, there's a Environment modifier to allow share cache between views in same context. It would be helpful in situations where Cache is initialized just once in runtime.
And remember, Cache
is only cache-memory, so use it wisely.
For file cache based, I trully recommend reading the article mentioned at See Also to understand and implement file-based cache.
LadyBug is cute and log messages along app execution. Behind the scenes LadyBug uses OSLog to perform log messages and store log in app archive according by level.
level | persisted | performance |
---|---|---|
debug | ❌ | faster |
info | ❓ (only during log collect ) |
faster (out of log collect), lower (during log collect ) |
notice | ✅ | lower |
error | ✅ | lower |
StatefulPreview
is a simple struct wrapped in a PreviewProvider
extension that enables stateful previews for SwiftUI views.
Fields wrapped in @Binding
annotation, are not easy to preview as stateful value. It's possible to wrap a value using .constant
utilty but it will not allow to modify the value.
// | |
// String+Localized.swift | |
// | |
// Created by Jan Cássio on 2021/03/27. | |
// Copyright © 2021 Jan Cassio. All rights reserved. | |
// | |
import Foundation | |
extension String { |