Skip to content

nicoonswift/ios_tips

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 

Repository files navigation

iOS development tips

Misc tips for iOS development

Best Practices

Testing

TestPlans

To display all current testplans related to an scheme

xcodebuild -showTestPlans -scheme MY_SCHEME

To run the tests as configured in a testplan

$ xcodebuild -project MY_PROJECT.xcodeproj/ -scheme MY_SCHEME -destination 'platform=iOS Simulator,OS=13.3,name=iPhone Xs'  test -testPlan MY_TEST_PLAN

Swift

The Official raywenderlich.com Swift Style Guide

Learning sources

Xcode

Free HD space used by Xcode's derived data.

  • Xcode 9.4.1
  • Open terminal
  • cd ~/Library/Developer/Xcode
  • rm -rf DerivedData
  • Source

Xcode 9.3 dev accounts session expiring on each app launch

  • Open Terminal
  • defaults write com.apple.dt.Xcode DVTDeveloperAccountUseKeychainService -bool NO
  • Source

Easy-open project/workspace

  • Open terminal
  • cd ~
  • xed .
  • Source

TIL: “xed .” will open the Xcode workspace or project file in the current directory. So many hours wasted typing “open projectname.xcworkspace” 🤦‍♂️ #swiftlang

— Michael Luís Brown (@mluisbrown) June 30, 2018

Resolving merge conflicts on project.pbxproj file

Use .gitattributes file as described here.

Debugging

Dotzu, In-app logging tool

  • Swift and Objective-C compatible
  • Install through Cocoapods
  • Source

UI Testing

Doubling localized Strings

  • Use NSDoubleLocalizedString as a launch argument
  • Source

Force Toggle Hardware Keyboard false (iOS Simulator)

  • Xcode 9.4.1
  • iOS 11.4.1
  • Source

Add a run script on UI Tests target:

/usr/libexec/PlistBuddy -c "Print :DevicePreferences" ~/Library/Preferences/com.apple.iphonesimulator.plist | perl -lne 'print $1 if /^    (\S*) =/' | while read -r a; do /usr/libexec/PlistBuddy -c "Set :DevicePreferences:$a:ConnectHardwareKeyboard
false" ~/Library/Preferences/com.apple.iphonesimulator.plist || /usr/libexec/PlistBuddy -c  "Add :DevicePreferences:$a:ConnectHardwareKeyboard
bool false" ~/Library/Preferences/com.apple.iphonesimulator.plist; done

Using Localized Strings

App Store

In-app purchases

Apple

Fastlane

Updating Ruby on macOS

WARNING: You are running Ruby 2.3.7, which is nearing end-of-life.

The Google Cloud API clients work best on supported versions of Ruby. Consider upgrading to Ruby 2.4 or later. See https://www.ruby-lang.org/en/downloads/branches/ for more info on the Ruby maintenance schedule. To suppress this message, set the GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable.

Proceed with:

Could not find CFPropertyList-3.0.0 in any of the sources

Your bundle is locked to json (1.8.3.1), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of json (1.8.3.1) has removed it. You'll need to update your bundle to a version other than json (1.8.3.1) that hasn't been removed in order to install.

Proceed with:

$ bundle update

Source

CocoaPods

Execute the following on your terminal to get the latest stable version:

$ sudo gem install cocoapods

Add --pre to get the latest pre release:

$ sudo gem install cocoapods --pre

You can check pod version using below command

$ pod --version

Tips

Pod Spec file validation

$ pod spec lint

For local development Pods

$ pod lib lint

Workarounds

⚠️ Local development Pods not being correctly rebuild using Xcode10.1

Provide an installation option to disable usage of input/output paths. #8105

  • Works with CocoaPods1.6.0.beta2
  • Add on the Podfile:
install! 'cocoapods', :disable_input_output_paths => true

To Read

About

Misc tips for iOS development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published