How to use deep link and universal link in iOS
Issue #548 https://stackoverflow.com/questions/35522618/universal-links-on-ios-vs-deep-links-url-schemes
Issue #548 https://stackoverflow.com/questions/35522618/universal-links-on-ios-vs-deep-links-url-schemes
Issue #547 func sync<T>(_ work: (@escaping ([T]) -> Void) -> Void) -> [T] { let semaphore = DispatchSemaphore(value: 1) var results = [T]() work { values in results = values semaphore.signal() } return results } sync({ completion in service.load(completion) })
Issue #546 Using the Flow Layout Customizing Collection View Cell Insertion Animations
Issue #545 Xcode 10 Localization catalog and XclocReader New Localization Workflows in Xcode 10 Xcode 11 localized screenshots Creating Great Localized Experiences with Xcode 11
Issue #544 man xcodebuild man xcodebuild XCODEBUILD(1) BSD General Commands Manual XCODEBUILD(1) NAME xcodebuild -- build Xcode projects and workspaces SYNOPSIS xcodebuild [-project name.xcodeproj] [[-target targetname] ... | -alltargets] [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [action ...] [buildsetting=value ...] [-userdefault=value ...] xcodebuild [-project name.xcodeproj] -scheme schemename [[-destination destinationspecifier] ...] [-destination-timeout value] [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [action ...] [buildsetting=value ...] [-userdefault=value ...] xcodebuild -workspace name.xcworkspace -scheme schemename [[-destination destinationspecifier] ....
Issue #543 Workspace Workspace has its own DerivedData folder DerivedData ModuleCache.noindex workspace_name Build Products Debug-iphonesimulator Cat Dog Dog2 Index Info.plist Logs Build Debug Install Issues Package Test LogStoreManifest.plist Test-scheme_name-2019.12.15_21-08-32-+0100.xcresult scm.plist SourcePackages TextIndex Note that workspace always needs a scheme to work xcodebuild: error: If you specify a workspace then you must also specify a scheme. Use -list to see the schemes in this workspace. Project Project has its own DerivedData folder....
Issue #542 With protocol extension See code Puma Build is UsesXcodeBuild is UsesCommandLine /// Any task that uses command line public protocol UsesCommandLine: AnyObject {} public extension UsesCommandLine { func runBash( workflow: Workflow, program: String, arguments: [String], processHandler: ProcessHandler = DefaultProcessHandler() ) throws { // Code } func runProcess( _ process: Process, workflow: Workflow, processHandler: ProcessHandler = DefaultProcessHandler() ) throws { // Code } } /// Any task that uses xcodebuild public protocol UsesXcodeBuild: UsesCommandLine { var xcodebuild: Xcodebuild { get set } } public extension UsesXcodeBuild { func runXcodeBuild(workflow: Workflow) throws { try runBash( workflow: workflow, program: "xcodebuild", arguments: xcodebuild....
Issue #541 Scheme action A scheme, either for app or test, consists of actions Run Used when Cmd+R. The executable specifies which app target to run Test Used when Cmd+U. The tests specifies which test target to run Test target recognises app targets via Test application and target dependency When specify test scheme, we are specifying Test action in test scheme, which builds test target, and by dependency, builds app target, then run test action in test scheme, which is the UITest...
Issue #540 testLanguage and testRegion -testLanguage language Specifies ISO 639-1 language during testing. This overrides the setting for the test action of a scheme in a workspace. -testRegion region Specifies ISO 3166-1 region during testing. This overrides the setting for the test action of a scheme in a workspace. xcodebuild -project 'TestApp.xcodeproj' -scheme 'TestAppUITests' -configuration Debug -sdk iphonesimulator -UseModernBuildSystem=YES -destination 'OS=13.2.2,name=iPhone 11,platform=iOS Simulator' -testLanguage ja -testRegion ja_JP test
Issue #539 XCUIScreenshot extension XCTestCase { func takeScreenshot(name: String) { let screenshot = XCUIScreen.main.screenshot() let attach = XCTAttachment(screenshot: screenshot) attach.lifetime = .keepAlways add(attach) } } Gather screenshot for localization Creating Great Localized Experiences with Xcode 11 xcresult from Xcode 11 https://www.chargepoint.com/engineering/xcparse/ xcparse Command line tool & Swift framework for parsing Xcode 11+ xcresult xcresulttool Testing in Xcode Test plan WWDC19: Getting Started with Test Plan for XCTest
Issue #538 Hierarchy UIToolbar -> _UIToolbarContentView -> _UIButtonBarStackVie UIToolbarContentView _UIToolbarContentView's width should equal 0 _UIToolbarContentView's height should equal 0 Workaround that fixes 1 warning toolbar.setItems(items, animated: false) toolbar.updateConstraintsIfNeeded() Set frame explicitly Use a non .zero frame that is close to the view bounds width let toolbar = UIToolbar(frame: CGRect(x: 0, y: 0, width: 375, height: 30)) DispatchQueue.main.async { self.toolbar.updateConstraintsIfNeeded() }
Issue #537 Specify launch arguments In xcodebuild, specify launch arguments. You can specify this under Launch Arguments in Run action of the app scheme or UITest scheme -AppleLanguages (jp) -AppleLocale (jp_JP) (lldb) po ProcessInfo().arguments ▿ 11 elements - 0 : "/Users/khoa/Library/Developer/CoreSimulator/Devices/561F2B45-26B2-4897-98C4-8A917AEB48D2/data/Containers/Bundle/Application/436E0A43-8323-4F53-BBE0-6F75F674916F/TestAppUITests-Runner.app/TestAppUITests-Runner" - 1 : "-AppleLanguages" - 2 : "(ja)" - 3 : "-AppleTextDirection" - 4 : "NO" - 5 : "-AppleLocale" - 6 : "ja_JP" - 7 : "-NSTreatUnknownArgumentsAsOpen" - 8 : "NO" - 9 : "-ApplePersistenceIgnoreState" - 10 : "YES" In UITests, pass launch arguments from UITest scheme to UITest application...
Issue #536 extension UITextField { func setLeftView(_ view: UIView, padding: CGFloat) { view.translatesAutoresizingMaskIntoConstraints = true let outerView = UIView() outerView.translatesAutoresizingMaskIntoConstraints = false outerView.addSubview(view) outerView.frame = CGRect( origin: .zero, size: CGSize( width: view.frame.size.width + padding, height: view.frame.size.height + padding ) ) view.center = CGPoint( x: outerView.bounds.size.width / 2, y: outerView.bounds.size.height / 2 ) leftView = outerView } }
Issue #535 datePicker.setValue(UIColor.green, forKey: "textColor") datePicker.setValue(false, forKey: "highlightsToday") In iOS 14 if #available(iOS 14.0, *) { datePicker.preferredDatePickerStyle = .wheels datePicker.tintColor = UIColor.green } Inspect attributes https://developer.apple.com/documentation/objectivec/nsobject/1415656-attributekeys
Issue #534 Workaround /Users/khoa/.rbenv/shims/bundler install
Issue #533 struct ContentView: View { @Environment(\.locale) var locale: Locale var body: some View { VStack { Text(LocalizedStringKey("hello")) .font(.largeTitle) Text(flag(from: locale.regionCode!)) .font(.largeTitle) } } }
Issue #532 func flag(from country: String) -> String { let base : UInt32 = 127397 var s = "" for v in country.uppercased().unicodeScalars { s.unicodeScalars.append(UnicodeScalar(base + v.value)!) } return s } Read moree Swift turn a country code into a emoji flag via unicode https://github.com/onmyway133/Smile
Issue #531 Expand commits in Sublime Merge { "expand_merge_commits_by_default": true, "translate_tabs_to_spaces": true } local hooks .git/hooks vs hooksPath git config core.hooksPath ~/.git-templates/hooks Only hooksPath gets run. Removing hooksPath make local hooks work https://stackoverflow.com/questions/39332407/git-hooks-applying-git-config-core-hookspath Use git templates https://coderwall.com/p/jp7d5q/create-a-global-git-commit-hook Define alias in zshrc vim ~/.zshrc alias check="~/.git-templates/hooks/check.sh" source ~/.zshrc pre-commit https://itnext.io/using-git-hooks-to-enforce-branch-naming-policy-ffd81fa01e5e (feature|fix|refactor)\/[a-z0-9-]+$
Issue #530 Although UIImageView frame is correct, image is still cropped. Watch out for any layer.mask within view
Issue #529 indexPath https://developer.apple.com/documentation/uikit/uicollectionviewlayoutattributes/1617786-layoutattributesfordecorationvie It is up to you to decide how to use the indexPath parameter to identify a given decoration view. Typically, you use the decorationViewKind parameter to identify the type of the decoration view and the indexPath information to distinguish between different instances of that view. Posts Add separator https://gist.github.com/tomaskraina/1eb291e4717f14ad6e0f8e60ffe9b7d3