How to conditionally apply css in emotion js
Issue #649
Check flag then define css
const Picture = (feature) => {
const shadowCss = feature.shadow ? css`
border-radius: 5px; …Discover all the tech
Issue #649
Check flag then define css
const Picture = (feature) => {
const shadowCss = feature.shadow ? css`
border-radius: 5px; …Issue #648
In a similar fashion to plain old javascript, note that href needs to have valid hash tag, like #features
<a
href='#features' …Issue #647
emotion can be used in framework agnostic or with React. To use with React, follow https://emotion.sh/docs/introduction#react
npm i @emotion/core …Issue #646
Pass DispatchQueue and call queue.sync to sync all async works before asserting
Use DispatchQueueType and in mock, call the work immediately
Issue #645
npm init
npm install webpack webpack-cli --save-dev
vim webpack.config.jsIssue #644
import XCTest
extension XCTestCase {
/// Asynchronously assertion
func XCTAssertWait(
timeout: TimeInterval = 1,
_ …Issue #643
Use material icons
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">Issue #642
Specify container with flex-wrap and justify-content, and item with float: left
div.cards {
display: flex;
justify-content: center; …Issue #641
Create a new page
hexo new page mydemoRemove index.md and create index.html, you can reference external css and js in this index.html. Hexo has …
Issue #640
async function useCache(
collectionName: string,
key: string,
response: functions.Response<any>,
fetch: () => Promise …Issue #639
Never use String(format: "%.2f %%", 1.2 because each region can have different separator and placement of percent sign.
Use NumberFormatter instead
Issue #638
Use commandDefinitions in XCSourceEditorExtension.
import Foundation
import XcodeKit
class SourceEditorExtension: NSObject, …Issue #638
Use commandDefinitions in XCSourceEditorExtension.
import Foundation
import XcodeKit
class SourceEditorExtension: NSObject, …Issue #636
Normally we can just wrap NSTextField
struct SearchTextField: NSViewRepresentable {
@Binding var text: String
var hint: String
var …Issue #635
textField.delegate = selfNSTextFieldDelegate …Issue #634
public enum Weapon: String, Decodable {
case sword = "SWORD"
case gun = "GUN"
case unknown = "UNKNOWN" …Issue #633
Use autoclosure and AnyView
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
public extension View {
func applyIf<T: View>(_ …Issue #632
Use Group
private func makeHeader() -> some View {
Group {
if showsSearch {
SearchView(
onSearch: …Issue #631
When your app moves to the background, the system …
Issue #630
For SwiftUI app using NSPopover, to show context popover menu, we can ask for windows array, get the _NSPopoverWindow and calculate the position. Note that origin of macOS screen is bottom left
I’m a thinker and storyteller with a passion for exploring the intersection of creativity and technology
🧑💻 I love crafting high quality and useful apps
🔥 I love open source. My GitHub open source has 2.3k followers with packages that are integrated by 45k+ apps and over 3.4m+ downloads on CocoaPods.
✍️ I write here on my blog and on Medium, which has over 2.7k+ followers with tons of articles and 90k+ monthly views.
🖥 Follow me for sharings about Swift, SwiftUI, iOS and macOS development.