Mobile Native section is aiming to align Android and iOS equivalent on all aspects.
declarative ui
- SnapKit
- Stevia
- SwiftUI (iOS 12+)
- ComponentKit (Facebook)
XML (preferred)
declarative ui
- Swinject (Swift) - lightweight, easy to use https://github.com/Swinject/Swinject
-
Koin (Kotlin) - lightweight, easy to use https://github.com/InsertKoinIO/koin
-
Dagger (Java) - complex, official https://github.com/google/dagger
Abstract the navigation and make it easier to handle
- XCoordinator https://github.com/quickbirdstudios/XCoordinator
- Cicerone https://github.com/terrakok/Cicerone
- Kingfisher https://github.com/onevcat/Kingfisher
- SDWebImage https://github.com/SDWebImage/SDWebImage
- Glide https://github.com/bumptech/glide
- Picasso https://github.com/square/picasso
- Fresco https://github.com/facebook/fresco
- Moya - Standardize API https://github.com/Moya/Moya
- Alamofire https://github.com/Alamofire/Alamofire
- Retrofit - Standardize API https://github.com/square/retrofit
- okhttp https://github.com/square/okhttp
- okhttp logging interceptor https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor
- okhttp profiler plugin https://github.com/itkacher/OkHttpProfiler
- Twine, share resource with standard data structure https://github.com/scelis/twine
native resource system should be enough
- CocoaLumberjack (Logging) https://github.com/CocoaLumberjack/CocoaLumberjack
- NSLogger (Mac Desktop App) https://github.com/fpillet/NSLogger
- netfox (Network logging) https://github.com/kasketis/netfox
- FLEX (All-rounded but more injected) https://github.com/FLEXTool/FLEX
- AlamofireSafariLogger (Safari popup for networking logging) https://github.com/springwong/AlamofireSafariLogger
- Logger (Logging) https://github.com/orhanobut/logger
- Stetho (Network logging) https://github.com/facebook/stetho
- Chunker (External Android Activity, release mode available) https://github.com/ChuckerTeam/chucker
- NSLogger (Mac Desktop App) https://github.com/fpillet/NSLogger
- Pandora (All-rounded but more injected) https://github.com/whataa/pandora
- RxSwift https://github.com/ReactiveX/RxSwift
- RxSwiftCommunity https://github.com/RxSwiftCommunity
- RxJava https://github.com/ReactiveX/RxJava
- RxKotlin https://github.com/ReactiveX/RxKotlin
- RxRelay 2-way https://github.com/JakeWharton/RxRelay
- RxBinding https://github.com/JakeWharton/RxBinding
- SwiftLint https://github.com/realm/SwiftLint
- InjectionIII https://github.com/johnno1962/InjectionIII
- Exist in android studio
- Local Unit Test https://developer.android.com/training/testing/unit-testing/local-unit-tests.html
- Jacoco https://github.com/arturdm/jacoco-android-gradle-plugin
- iOS https://github.com/airbnb/lottie-ios
- Android https://github.com/airbnb/lottie-android
- React Native https://github.com/lottie-react-native/lottie-react-native
- iOS https://github.com/onmyway133/RxLifeCycle
- Android https://developer.android.com/jetpack/androidx/releases/lifecycle
- Java https://github.com/square/javapoet
- Kotlin https://github.com/square/kotlinpoet
- Swift https://github.com/krzysztofzablocki/Sourcery
https://code.visualstudio.com/docs/languages/jsconfig
https://code.visualstudio.com/
-
Find file CMD + P
-
Search text in file CMD + F
-
Search text in workspace CMD + SHIFT + F
-
Replace text in workspace CMD + SHIFT + H
-
Vertical select OPTION + SHIFT + SELECT
- Numbered Bookmarks
- Snippetes (React / Angular JS )
- Paste JSON as Code
- Prettier - Code formatter
- Eslint
- Debugger for chrome
- Reactotron https://github.com/infinitered/reactotron
import { ArgType } from "reactotron-core-client";
Reactotron.onCustomCommand({
command: "Open Webview",
handler: params => {
const path = params.path;
// do something
},
title: "Open Webview", // This shows on the button
args: [
{
name: "path",
type: ArgType.String,
},
],
})
-
Facebook Flipper (Default) https://github.com/facebook/flipper
-
React DevTools https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi
- Storybook https://github.com/storybookjs/storybook
-
React Query https://react-query.tanstack.com/
-
react cosmos https://github.com/react-cosmos/react-cosmos
-
axe-core https://github.com/dequelabs/axe-core-npm/tree/develop/packages/react
-
Relay (GraphQL) https://github.com/facebook/relay
-
Rx Observable https://github.com/redux-observable/redux-observable
- componentDidMount
- componentDidUpdate
- componentWillUnmount
https://reactjs.org/docs/hooks-intro.html
function App() {
// count: reactiveValue
// setCount: setter
// 0 here is initial state;
const [count, setCount] = useState(0);
return (<div>count</div)>);
}
function App() {
useEffect(() => {
// trigger as componentDidMount and componentDidUpdate
alert('hello world')
// return function trigger when componentWillUnmount
return () => alert('componentWillUnmount');
},
// dependencies, run when array reactiveValue changes
[])
}
Context is based on Context API which provide Content with Provider pattern
mutable value does not re-render UI.
useReducer is for redux pattern
function App() {
const [state, dispatch] = useReducer();
return <>
Count: {state},
onPress: () => { dispatch({type: 'xxx', payload: {}})}
</>
}
cache result of function call, rare case to use
function App() {
const [count] = useState(60);
const expensiveCount = useMemo(() => {
return count ** 2;
}, [count])
return <></>;
}
useCallback to prevent unnecessary re-render
function App() {
const [count] = useState(60);
const callback = useCallback(() => {
alert('123);
}, [count])
return <><button onPress={callback}></button></>;
}
runs after the render but before painting to screen blocks visual updates until your callback is finished
Instead of
function App() {
const [count, setCount] = useState(0);
useEffect(() => {
alert(count)
}, [])
return (<div>count</div)>);
}
We can
function countFunc() {
const [count, setCount] = useState(0);
useEffect(() => {
alert(count)
}, [])
useDebugValue(count ?? 'I am zero')
return count;
}
function App() {
const count = countFunc();
return (<div>count</div)>);
}
import _ from "lodash";
- React Native Community https://github.com/react-native-community
- moment https://momentjs.com/
- Crypto JS https://github.com/brix/crypto-js
- JWT decode https://github.com/auth0
- Query String https://nodejs.org/api/querystring.html
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": true
}
- Bundle size https://bundlephobia.com/
https://nodejs.org/en/docs/guides/debugging-getting-started/
// simple one, listen on 127.0.0.1:9229
node --inspect index.js
// Break before code starts
node --inspect-brk index.js
// listen on other ports
node --inspect=[host:port] index.js
// Chrome inspector, in chrome url, open:
chrome://inspect
// Visual Studio Code, start debug mode
Terminal > DropDown > 'Create Javascript Debug Terminal'
PostCSS https://postcss.org/
Stylus https://stylus-lang.com/
Less https://lesscss.org/
Single Columns/rows
.flex {
display: flex;
justify-content: center;
align-items: center;
}
multiple columns/rows
.grid {
display: grid;
grid-template-columns: 1fr 500px 1fr;
grid-template-rows: 100px 200px;
place-items: center;
}
Simple way
.size {
width: 50%;
}
@media only screen and (max-width:600px) {
.size {
width: 200px;
}
}
@media only screen and (min-width: 1200px) {
.size {
width: 800px;
}
}
Advance way:
.size {
width: clamp(200px, 50%, 600px);
}
.ratio {
width: 100%;
aspect-ratio: 16/9;
}
// :root is global scope of variables. To use local scope, declare it inside the selector.
:root {
--text-color: rgb(255, 0, 0);
--r: 128;
--g: 0;
--b: 0;
--another-color: rgb(var(--r), var(--g), var(--b));
}
p {
color: var(--text-color);
}
// override text-color in local scope
h1 {
--text-color: rgb(0, 0, 0);
color: var(--text-color);
}
h2 {
color: var(--another-color);
}
width: calc(100vm - 80px);
font-size: calc(1rem * 1.25);
padding: calc(5% + 2px);
// calc X variables to achieve smooth delay
.order {
animation-delay: calc(var(--order) * 100ms);
}
<i class="drop" style="--order: 1">1</i>
<i class="drop" style="--order: 2">2</i>
<i class="drop" style="--order: 3">3</i>
:root {
counter-reset: headings;
}
h1 {
counter-increment: headings;
}
h1::before {
content: counter(headings);
}
button:foucs-within .dropdown {
opacity: 1;
visibility: visible;
}
// Fixed units
h1 {
font-size: 14px;
}
// Relative units, em / rem
// em relative to parent's font size
// if parent font size is 12px, 2em = 12px * 2 = 24px
// rem relaive to root font size
h1 {
font-size: 1em;
padding: 1rem;
}
// character width, ch, definition of character here is width of "0"
// in this example, width is from minimum 45 characters to 75 characters
.card {
width: clamp(45ch, 50%, 75ch);
}
// relative to viewport, vw / vh, unit is x% of viewport width / height
// vmin / vmax is relative to 1% of viewport's smaller / larger dimension
h1 {
font-size: 20vw;
}
-
rgb rgb(255, 0, 0)
-
hsl hsl(0, 35%, 50%)
article {
scroll-padding: 1rem 0 0 0;
}
content-visibility https://developer.mozilla.org/en-US/docs/Web/CSS/content-visibility
- multiple css for media
<!-- style.css contains only the minimal styles needed for the page rendering -->
<link rel="stylesheet" href="styles.css" media="all" />
<!-- Following stylesheets have only the styles necessary for the form factor -->
<link rel="stylesheet" href="sm.css" media="(min-width: 20em)" /><link rel="stylesheet" href="md.css" media="(min-width: 64em)" /><link rel="stylesheet" href="lg.css" media="(min-width: 90em)" /><link rel="stylesheet" href="ex.css" media="(min-width: 120em)" /><link rel="stylesheet" href="print.css" media="print" />
- Parallel / in-series call on css files
Free, easy to integrate with iOS and Android. mock data available.
https://www.telerik.com/fiddler
- Web / API Deployment
- OpenShift (Docker) https://www.openshift.com/
- Mobile Deployment
- Mac agent support
- .yaml: to control the steps
- secure files: store certificate / keystore
- variable group: to store values whiic are private / public to devs
- built binary is stored in Artifact
- Trigger by artifact build
- tasks to take action on artifact, i.e. upload testflight, appcenter
- Approver can be invovled between tasks
- Service connection to setup account information
Fastlane https://fastlane.tools/