2020 Monthly I Learned - kirseia/study GitHub Wiki
-
AVAudioEngine ์ ํ์ฉํ ๋ น์๊ธฐ ๊ฐ๋ฐ
- ํต์ฌ์ mixer.volume = 0์ผ๋ก ์ ๋ ฅ๋จ์์์ ์์ ์ ๊ฑฐ(๋ น์๊ธฐ ์๋ฆฌ๋ง ๋ฝ๊ธฐ),
- engine.connect(mixerNode, to: engine.mainMixerNode, format: mixerFormat) ์ผ๋ก mainMixerNode ๋ก ์ฐ๊ฒฐํ๋ ๊ฒ (engine.outputNode ๊ฐ ์๋๋ผ)
- outputNode๋ก ์ฐ๊ฒฐํ๋ฉด ๋ง์ดํฌ ์ ๋ ฅ๊ฐ์ด ์คํผ์ปค๋ก ์ถ๋ ฅ๋์ด ๋ค์ ๋ง์ดํฌ๋ก ์ ๋ ฅ๋๋ ํ์์ด ๋ฐ์ํ ์ ์์
-
๋ก์ปฌ ํธ์ ๋ฑ๋ก ๋ฐ ์ฒ๋ฆฌ 1, 2
- ๋ก์ปฌ ํธ์์ ์ด๋ฏธ์ง๋ฅผ ์ถ๊ฐํ ๋๋ move ๋๊ธฐ ๋๋ฌธ์ ์ฌ์ฉํ ์ด๋ฏธ์ง๋ฅผ ๋ณต์ฌํด์ url์ ๋๊ฒจ์ค์ผ ํจ
- (but, main bundle ์ด๋ฏธ์ง๋ ๋ณต์ฌ๋จ)
- ์ฌ์ง ์์ ๊ณต์ ์ phasset ์ด ์๋๋ผ image url์ด ๋ค์ด์ด
- image orientation ์ด ์ด์์๋ ์ํ -> ์ฌ์ฉ ๋ฐฉ์์ ๋ฐ๋ผ UIImage.Orientation.up ์ผ๋ก ๋ณด์ ํ์.
- Extension ๊ณผ Host app ์ฌ์ด์ ๋ฐ์ดํฐ ์ฃผ๊ณ ๋ฐ๊ธฐ๊ฐ ์๋๊ธฐ ๋๋ฌธ์ image url ์ ํ์ผ๋ก ์ ์ฅํด๋ Host app ์์ ๋ก๋๊ฐ ์๋จ, App groups๋ฅผ ํ์ฉํด์ผ ํจ
- Host app ์ด multi targets ์ด๊ณ , Share Extension ์ ํ๋์ผ๋๋ Host app์์ ๋น๋ํ ๋ embed ์ดํ์ re-signing ๊ณผ์ ์ด ํ์ํจ
- Ref. https://stackoverflow.com/questions/25398636/ios-extensions-with-multiple-targets
- Ref. https://gist.github.com/damian-rzeszot/0b23ad87e5ab5d52aa15c095cbf43c59
- ์์คํ ์ ์๋ ํฐํธ ๋ถ๋ฌ์ค๊ธฐ
UIFont.systemFont(...) ์ผ๋ก๋ ๊ธฐ๋ณธ ํฐํธ๋ง ๋ก๋ ๊ฐ๋ฅ
for familyName in UIFont.familyNames {
for fontName in UIFont.fontNames(forFamilyName: fontFamilyName) {
// ์ด๋ ๊ฒ ํ๋ฉด ๋ก๋๊ฐ ์๋จ. ์์คํ
ํฐํธ๋ง ๋ก๋๋จ
let font_x = UIFont.font(with: fontName, fontSize: 10)
// ์ด๋ ๊ฒ ํด์ผ ๋จ, ์ด์ ๋ ๋ชจ๋ฆ.;
let description = UIFontDescriptor(name: fontName, size: 10)
let font_o = UIFont(descriptor: description, size: 10)
}
}
- ๊ฐ ํ๋ซํผ ๊ณต์ ๊ธฐ๋ฅ ์ ๋ฆฌ
- ์ธ์คํ - > ํ์ - ์ต์ 3์ด, ์ต๋ 10๋ถ, ์ต์ 640x640
- "instagram://library?LocalIdentifier=\(assetIdentifier)&InstagramCaption=\(tagString)")
- ์ ์คํด์ผ๋ก ํผ๋/์คํ ๋ฆฌ ์
๋ก๋ ํ์ด์ง๋ก ๋ฐ๋ก ์ด๋ ๊ฐ๋ฅ - ๋น๊ณต๊ฐ ์คํ
- https://developers.facebook.com/docs/instagram/sharing-to-feed
- ์ธ์คํ ์คํ ๋ฆฌ - ํ์ - ์ต๋ 20์ด, ์ต์
- 1080p , 50๋ฉ๊ฐ ๋ฏธ๋ง
- "instagram-stories://share?source_application=\(bundleIdentifier)"
- scheme + pastebox ํ์ฉํด์ ๊ณต์ ๊ฐ๋ฅ
- https://developers.facebook.com/docs/instagram/sharing-to-stories/
- ์ ํ๋ธ - api ๋ก ์
๋ก๋ ํด์ผ ํจ, ์ต๋ 128๊ธฐ๊ฐ
- youtube://upload scheme (๋น๊ณต๊ฐ ์คํ) ์ผ๋ก ์์ฑ ํ์ด์ง๋ก ๋ฐ๋ก ์ ๊ทผ ๊ฐ๋ฅ
- https://developers.google.com/youtube/v3/docs/videos/insert
- ํฑํก - sdk ํ์,
- 2์ด ~ 60์ด ์ฌ์ด, ์ํฐ๋งํฌ ์์ผ๋ฉด ์ญ์ ๋ ์ ์์. 500๋ฉ๊ฐ ์ ํ, 1080p ์ฌ์ผ ํจ.
- https://boosted.lightricks.com/tiktok-video-length-video-formatting-guide/
- ํ๋ถ - sdk ํ์ (๋ค์ด์์, ์ฌ์ฉ ๊ฐ๋ฅ)
- ๋์์, 50๋ฉ๊ฐ ๋ฏธ๋ง
- https://developers.facebook.com/docs/sharing/sharing-to-stories/ios-developers/
- ๋ผ์ธ sdk ํ์
- 300๋ฉ๊ฐ, 1.5๋ถ์ด ์ ํ
- wechat sdk ํ์
- 100๋ฉ๊ฐ ์ ํ
- https://developers.facebook.com/docs/whatsapp/api/media/
- qq ๋ฉ์ ์ ธ sdk ํ์
- ์์ธ ์ฑ
- https://faq.whatsapp.com/iphone/how-to-link-to-whatsapp-from-a-different-app/?lang=kr
-
์ธ์คํ๊ทธ๋จ์ PHAsset.localIdentifier(path๋ก๋ ๋๋๊ฑฐ ๊ฐ์?) ์ ๋ก๋ ํ๊ธฐ
-
App Group ์ ์ด์ฉํด Share extension ๊ณผ ๋ฐ์ดํฐ ๊ตํ, ํ์ผ์ ์ฅ
-
swift ์์ a == false ๊ฐ !a ๋ณด๋ค ๋น๋ ์๋๊ฐ ๋๋ฆฌ๋ค?
- ๋์ถฉ ์ฝ๋ฉํธ๋ค ๋ณด๋ == ์ฐ์ฐ์ ์ค๋ฒ๋ผ์ด๋๊ฐ ๋ง์ ํ์ ์์(์ฝ 70๊ฐ) ์ด์ฉ๋๊ณ ์์ด์ ํ์ ์ฒดํนํ๋๋ฐ ์ค๋ ๊ฑธ๋ฆฌ๋๊ฒ ๊ฐ์
- Bool(false) ์ฒ๋ผ false ์ ํ์ ์ ๋ช ํํ ๋ช ์ํด์ฃผ๋ฉด ํด๊ฒฐ๋๋ ๊ฒ ๊ฐ์
- ์ฝ๋ ๊ฐ๋ ์ฑ์ ์ํด์๋ ํน๋ณํ == false ๋ฅผ ํฌ๊ธฐํ ํ์๋ ์์๊ฒ ๊ฐ์ง๋ง, ํจ์ ์ปดํ์ผ ํ์ ๊ฒ์ฌํด์ ์ค๋๊ฑธ๋ฆฌ๋ฉด ํ์ ๋ช ์๋ฅผ ํด์ฃผ๋๊ฒ ์ข์ ๋ฏ
- iOS 13 ์ดํ๋ก XCode12 ์์ svg ๋ฒกํฐ ์ด๋ฏธ์ง ์ง์
- ๊ณ ์ ํญ์ซ์ ์ฌ์ฉํ๊ธฐ
- SwiftUI ์นํธ์ํธ
- iOS 14 ๋์ ๋ชฉ๋ก
- SKOverlay - ์ฑ ์ค์น ์ถ์ฒ
- iOS 14 ์ ๊ธฐ๋ฅ๋ค
- SwiftUI+AVPlayer
- SwiftUI ํ ์คํธ ํ๋ responder ๋์์ ํค๋ณด๋ ์์น์ ๋ง๊ฒ ์์น ์ด๋์ฒ๋ฆฌ
- Apple true type font manual
- vertical glyph : true ํ์ ๋ label ์ฌ์ด์ฆ ๊ณ์ฐ
- if let b = a as? Int ๋ณด๋ค if case let b as Int = a ๊ฐ ๋น ๋ฅด๋ค๊ณ ํจ
let a: Any = 120
if let b = a as? Int {
// 0.011 s
}
๋ณด๋ค
let a: Any = 120
if case let b as Int = a {
// 0.001 s
}
- ํ ์คํธ ์ธ๋ก ์ฐ๊ธฐ ์ฐธ๊ณ ํ ๊ฒ ์ถ๊ฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
- ์ธ๋ก ์ฐ๊ธฐ ๊ด๋ จ w3.org ๋ฌธ์ 1
- ์ธ๋ก ์ฐ๊ธฐ ๊ด๋ จ w3.org ๋ฌธ์ 2
- ์ฑ์คํ ์ด ๋ฑ๋ก์ ํ์ํ ์๋ฃ
- ์ธ์ด ํํฐ๋ง์ฉ RegEx
- ์ด๋ชจ์ง ํํฐ๋ง RegEx
- symbolicate ์๋์ด์๋ ํฌ๋์ ๋ก๊ทธ ๋ณํํ๊ธฐ
- ๋ ์ง, ๋ฆฌ์คํธ, ์ซ์ ๋ค๊ตญ์ด ์ฒ๋ฆฌ
- ๋น๋์ค ๋ค์ด๋ก๋ ๋์คํฌ ์บ์
- ios14 ์์ ๊ธฐ๋ณธ ๋ธ๋ผ์ฐ์ ๋ฅผ ๋ฐ๊ฟจ์๋ canOpenUrl ๋์ ์ค๋ฅ
-
๋จ ๋์คํฌ๋ฅผ ํ์ฉํ ๋น๋ ์๋ ๊ฐ์
- ๋ ๋ด๊ฐ ์ฌ์ฉํ๋ ํ๋ก์ ํธ์์๋ ํจ๊ณผ ์์์, ๋ค๋ง ssd ์๋ช ํฅ์์๋ ๋์์ด ๋ ๊ฒ ๊ฐ์, ๋์คํฌ ์ฉ๋ ์ค์ด๋๊ฑฐ๋
- ํ ์คํธ ์ธ๋ก ์ฐ๊ธฐ ๋ทฐ ์ํ - 1, 2, 3
- ์ค๊ตญ์์ ์ฌ์ดํธ ์ ์๋๋์ง ํ ์คํธํ๊ธฐ
- ์ธ์ด ํํฐ๋ง Regular expression
- Debug ๋น๋ ์๋ ํฅ์ ํ - sha256 -> sha1, code signing speed up
-
sourcetree git invalid name or password ๋์
- ssh ๋ฐฉ์์ด๋ฉด ์ด๋ฐ์ผ์ด ์๊ฒ ์ง๋ง ์ปค๋งจ๋๋ผ์ธ์์ ์ ๋ฐ์ดํธํด๋ sourcetree ์์ ๋ฌธ์ ์๊ธธ๋ system git ์ ์ฐ๋ฉด ๋จ.
- Custom scheme ํ ์คํธํ๊ธฐ (์๋ฎฌ๋ ์ดํฐ)
- ๋น๋์๋ ๊ฐ์ ํ๊ธฐ
- URLComponent
- ์ด๋ฏธ์ง ๋ฆฌ์ฌ์ด์ฆ/์์ฑํ ๋ก์ง ๊ฐ์ ์ผ๋ก ๋ฉ๋ชจ๋ฆฌ ์ ์ฝํ๊ธฐ
- WWDC 2020 ์ธ์ ๋ค
- iOS 14 ๋์์ธ ๋ฐ๋์
-
iOS 14 - App Clip ์ดํด๋ณด๊ธฐ
- App clip - ์ ์ฒด๋ฅผ ๋ค์ด๋ก๋ํ์ง ์๊ณ ์์ ๊ธฐ๋ฅ ์กฐ๊ฐ์ ์ ๊ณตํ๋ ๊ฒ, ์ ์ฝ์ด ๋ง์
- iOS 14 - Widget ๋ง๋ค๊ธฐ
- os.log ์ฌ์ฉํด๋ณด๊ธฐ
- ์ฑ ์ํ๊ธฐ์ตํ๊ธฐ - NSUserActivity
- Launch Screen by info.plist
- CIFilter with LUT
- App Extension ๊ณผ ์๋ฃ ๊ณต์ - UserDefaults ์ฌ์ฉ
- WidgetKit - https://zeddios.tistory.com/1077 / https://eunjin3786.tistory.com/210
-
Launch Screen
- launchscreen:// ์ ์ด์ฉํ ๋ฅ๋งํฌ๋ก ๊ฐ๋ณ ๋ฐ์น์คํฌ๋ฆฐ์ ์ ๊ณตํ ์๋ ์์
- ๊ธ ์ค์ RocketSim ์ฑ์ ํตํด ์๋ฎฌ๋ ์ดํฐ์์ ๋ ์ฝ๋ฉ/์คํดํ ์คํธ/๋ฅ๋งํฌ ํ ์คํธ๋ฅผ ๊ฐ๋ฅํ๊ฒ ํด์ค
- Xcode build system
- Meta tutorial
- Property Wrapper๋ฅผ ํ์ฉํ ๊ธฐ๋ณธ๊ฐ์ ๊ฐ์ง Decoder ๊ตฌํ
- Share Extension
- Swift Package Manager
- XCTest ์์์๊ฐ ๋จ์ถํ๊ธฐ - ๋ผ์ด๋ธ๋ฌ๋ฆฌ ํ ์คํธํ๊ธฐ
- Version string ๋น๊ตํ๊ธฐ
- ์คํ๋์ ์ด๋ฏธ์ง ์ ๋ฐ์ดํธ ์๋ ๋ ๊ฐ์ ๋ก ์ญ์ ํ๊ณ ํ ์คํธ ํ๋ ๋ฐฉ๋ฒ
- iOS memory warning ๊ด๋ จ
- ๋ฉ๋ชจ๋ฆฌ ๋ถ์กฑ์ 3๊ฐ์ง ๋ฐฉ๋ฒ์ผ๋ก ์ ์ ์์
AppDelegate.applicationDidReceiveMemoryWarning(_:) <- ์ด๊ฒ ๊ฐ์ฅ ๋จผ์ ํธ์ถ๋จ
UIApplicationDidReceiveMemoryWarningNotification
UIViewController.didReceiveMemoryWarning() <- ๋ง์ง๋ง ํธ์ถ ๋จ
- iOS CVPixelBuffer resize using Accelerate
- iOS ๋๋ฐ์ด์ค ์ฌ์ฉ ๋ฉ๋ชจ๋ฆฌ/์ ์ฒด ๋ฉ๋ชจ๋ฆฌ ํ์ธ ํจ์
static var totalMemorySpace: UInt64 {
ProcessInfo.processInfo.physicalMemory / UInt64(1024 * 1024)
}
static var usedMemorySpace: UInt64 {
// The `TASK_VM_INFO_COUNT` and `TASK_VM_INFO_REV1_COUNT` macros are too
// complex for the Swift C importer, so we have to define them ourselves.
let TASK_VM_INFO_COUNT = mach_msg_type_number_t(MemoryLayout<task_vm_info_data_t>.size / MemoryLayout<integer_t>.size)
guard let memoryLayout = MemoryLayout.offset(of: \task_vm_info_data_t.min_address) else {
return 0
}
let TASK_VM_INFO_REV1_COUNT = mach_msg_type_number_t(memoryLayout / MemoryLayout<integer_t>.size)
var info = task_vm_info_data_t()
var count = TASK_VM_INFO_COUNT
let kr = withUnsafeMutablePointer(to: &info) { infoPtr in
infoPtr.withMemoryRebound(to: integer_t.self, capacity: Int(count)) { intPtr in
task_info(mach_task_self_, task_flavor_t(TASK_VM_INFO), intPtr, &count)
}
}
guard kr == KERN_SUCCESS, count >= TASK_VM_INFO_REV1_COUNT else {
return 0
}
return info.phys_footprint / UInt64(1024 * 1024)
}
- ์ ์ฉํ iOS ๊ฐ๋ฐ ๋์ ํ๋ก๊ทธ๋จ๋ค
- XCLogParser
- vDSP max ๊ตฌํ๊ธฐ
- ๋น๋ ์๋ ๋ถ์/๊ฐ์ ํ
- class ์ ์ถ๊ฐํ๋ protocol ์ class ๋์ AnyObject ๋ฅผ ๊ตฌํํ์
- xib/storyboard ๋ทฐ๊ฐ ์ ๋ฐ์ดํธ๊ฐ ์๋ ๋
- ์ปดํ์ผ ์๋๋ฅผ ๋๋ฆฌ๊ฒํ๋ ์ฝ๋๋ค 1
- ์ปดํ์ผ ์๋๋ฅผ ๋๋ฆฌ๊ฒํ๋ ์ฝ๋๋ค 2
- ์ปดํ์ผ ์๋ ์ต์ ํ ํ - ํ๊ธ
- Array init ์๋ ๋น๊ต
// average: 0.315 seconds (macOS Sierra 10.12.5)
func testInitializedArrayPerformance() {
self.measure {
var array = [Float](repeating: 1, count: 2048 * 2048)
for i in 0..<array.count {
array[(i+1)%array.count] = Float(i)
}
}
}
// average: 0.043 seconds (macOS Sierra 10.12.5)
func testUninitializedArrayPerformance() {
self.measure {
var array : [Float] = []
array.reserveCapacity(2048 * 2048) <- ์ ค ๋น ๋ฆ
array.append(0)
for i in 0..<(2048 * 2048) {
array.append(Float(i))
}
array[0] = Float(2048 * 2048-1)
}
}
// average: 0.077 seconds (macOS Sierra 10.12.5)
func testNativeArrayPerformance() {
self.measure {
let count = 2048 * 2048
let array = UnsafeMutablePointer<Float>.allocate(capacity: count)
for i in 0..<count {
array[(i+1)%count] = Float(i)
}
array.deallocate(capacity: count)
}
}
- switch case ํ๋ฐฉ์ ๋ค ์ ๋ ฅํ๊ธฐ
- Memory Warning ์ผ์ผํค๊ธฐ
- ์๋ฎฌ๋ ์ดํฐ์์ ์ต์ ์ผ๋ก ์คํ (Simulate Memory Warning menu item.)
- Private api ๋ฅผ ์ฌ์ฉ
[[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)];
-
destructuring tuple - https://medium.com/flawless-app-stories/tuples-in-swift-f55d64c55cf4
func testTuple() {
let (a, b) = makeTuple()
print(a)
print(b)
}
func makeTuple() -> (Int, Int) {
return (1, 1)
}
-
์ฑ์คํ ์ด ์ ๋ก๋ ํ Too many symbol files ๋ฉ์์ง ์ฒ๋ฆฌ - ์ฐธ์กฐ
- ๊ฒฐ๊ณผ์ ์ผ๋ก๋ pod ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ dsym ์ด ๋ฌธ์ ์ธ๋ฏ
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
config.build_settings['VALID_ARCHS'] = 'arm64'
end
end
end
+ carthage ์ชฝ์ ๋น๋ ํ ๋ '--no-use-binaries' ์ต์
์ ์ค๋ค
In Xcode, look in Build Settings for โStrip Debug Symbols During Copyโ (COPY_PHASE_STRIP). When enabled, debug symbols are omitted from your .app and placed into a .dSYM file. Otherwise your .app contains these symbols. (By default, debug symbols are stripped from release builds for reasons of obfuscation. You probably shouldnโt change this setting for the release configuration.)
- AVAudioMixParameters ์์ audioPitchAlgorithm ์ ์์ ๋ฐฐ์์ด ๋น ๋ฅผ ๊ฒฝ์ฐ timeDomain / spectral ์ด ๊ณ์ฐ๋์ด varispeed ๋ณด๋ค ๋๊ฑฐ๋ ๋ฎ์์๋ ๋ถ๊ตฌํ๊ณ ๋น์ ์ ๋์์ ํจ, varispeed์ ๊ฒฝ์ฐ ๊ณ์ฐ๋์ ์ค๊ฐ์ด์ง๋ง pitch correction ์ด ๋น ์ ธ์์ธ์ง, ์ด์ ๋ ๋ชจ๋ฅด๊ฒ ์ง๋ง ์ ์๋์ ํจ. (composition ๊ตฌ์ฑ์์ ์ฌ์์ ์๋๋, export ๊ฐ ์๋๋ ํ์์ด ์์์)
- ๊ธฐ๊ธฐ์์ H.265 ์ง์ํ๋์ง ํ์ธํ๊ธฐ
let isHEVC = AVOutputSettingsAssistant.availableOutputSettingsPresets().contains(.hevc3840x2160)
- Print Unescaped String
- ๋น๊ฐ๋ฐ - ์คํํธ์ ์์ ์์์ผ๋ก ๋ณด์๋ฅผ ๋ฐ์ ๋ - ์ฃผ์ด์ ๊ฑฐ์น์ง ์์ผ๋ฉด ๋ฐํํด์ผ ํ ์ง๋
- Xcode Build Process
- URLSession ์ผ๋ก ํ์ผ ๋ฐ์ ํ ํ์ผ ์ญ์ ๋๋ ํ์
/* Sent when a download task that has completed a download. The delegate should
* copy or move the file at the given location to a new location as it will be
* removed when the delegate message returns. URLSession:task:didCompleteWithError:
* will still be called. */
URLSession ์ผ๋ก ํ์ผ์ ๋ฐ๊ณ ๊ฒฐ๊ณผ delegate ๋ด์์ ํ์ผ์ ๋ณต์ฌํ๊ฑฐ๋ ์ด๋์์ผ์ผ์ง, ํด๋น delegate๊ฐ ์ข
๋ฃ๋๋ฉด ํ์ผ์ด ์ฌ๋ผ์ ธ๋ฒ๋ฆฐ๋ค.
main.queue ์์ ํด๋น ์์
์ ํ๋ ค๊ณ ํ๋๋ ๊ฐ๋ ๋ค์ด๋ฐ์ ํ์ผ์ด ์ฌ๋ผ์ง๋ ํ์์ด ์์ด์ ์์ ํ์๋ค.;;;