Xcode - RIP Tutorial · 1: Xcode Xcode macOS, iOS, watchOS tvOS macOS . Xcode NeXT Project Builder...

40
Xcode #xcode

Transcript of Xcode - RIP Tutorial · 1: Xcode Xcode macOS, iOS, watchOS tvOS macOS . Xcode NeXT Project Builder...

Xcode

#xcode

1

1: Xcode 2

2

2

Examples 3

3

Xcode 4

4

4

2: @IBDesignable Interface Builder 5

5

Examples 5

5

3: Xcode 8 8

8

Examples 8

8

4: Xcode IDE 9

9

Examples 9

Xcode 9

12

5: Xcode 13

Examples 13

Xcode 13

Xcode 7 14

14

14

15

Xcode 8 . 16

6: 18

Examples 18

TargetConditionals 18

7: 20

Examples 20

20

, 21

, , 22

8: 23

Examples 23

23

Xcode-9 26

9: 28

Examples 28

28

, . 28

29

Xcode (xcrun) . 30

xcode-select 30

10: , 31

Examples 31

31

Xcode 31

Xcode 7 31

Xcode 8 31

31

31

11: 33

Examples 33

33

33

33

, , , 34

. 34

36

You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: xcode

It is an unofficial and free Xcode ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official Xcode.

The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners.

Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to [email protected]

https://riptutorial.com/ko/home 1

Xcode

Xcode ( ). Finder .

: App Store Xcode . Xcode .

Xcode ( clang , xcodebuild ) . /usr/bin .

Xcode Xcode .

xcode-select .

# Print the currently selected version

IDE , . Xcode XCODE -> '' .

' ' .

AND W C . Xcode . (, ) . ( ).

( , , ) . , 'Numbers' . 'American Typewriter'( ) 24px .

.

' ' '' !

IDS ( , ) . Xcode ' ' '' . (), () ( ) . . , IDE ( , ) . , . .

: 0

: Y

: 0

Xcode : https://riptutorial.com/ko/xcode/topic/294/xcode-

https://riptutorial.com/ko/home 4

2: @IBDesignable Interface Builder @IBDesignable @IBDesignable @IBInspectable Interface Builder . . . .

Objective-C . Objective-C IB_DESIGNABLE IBInspectable. Swift .

Examples

iOS , ( - !). Interface Builder . .

.

import UIKit @IBDesignable class MyRoundedView: UIView { @IBInspectable var radius: CGFloat = 8 { didSet { self.layer.cornerRadius = radius } } override func awakeFromNib() { self.layer.cornerRadius = self.radius self.layer.masksToBounds = true } }

IB UIView . ID MyRoundedView .

https://riptutorial.com/ko/home 5

"Classes" "Designables" "Module" "Up to date" "Updating" . Xcode MyRoundedView .

Attributes Inspector , "My Rounded View" "Radius" ( ). ). @IBInspectable Attributes Inspector .

!

https://riptutorial.com/ko/home 6

@IBDesignable Interface Builder : https://riptutorial.com/ko/xcode/topic/6193/-ibdesignable--interface-builder----

https://riptutorial.com/ko/home 7

3: Xcode 8 Swift 3+ .

Examples

Xcode 8 UIImage .

. let img = dog . img dog .

#imageLiteral (resourceName : "dog.png") . .

imageView.image = img .

instellisense .

Xcode 8 : https://riptutorial.com/ko/xcode/topic/7155/xcode-8-

https://riptutorial.com/ko/home 8

4: Xcode IDE Xcode IDE .

Examples

Xcode

Xcode .

+ +⌃+ +T .

bash .1.

#!/bin/bash # Project Name: $XcodeProject # Project Dir: $XcodeProjectPath # Workspace Dir: $XcodeWorkspacePath open -a Terminal "$(dirname $XcodeProjectPath)"

. chmod +x your_script_name.sh chmod +x your_script_name.sh2.

Xcode 3.

+ .4.

Run 5.

https://riptutorial.com/ko/home 9

Choose Script... Choose Script... .6.

chmod +x .

https://riptutorial.com/ko/home 10

( : + +⌃+ +T ) 7.

https://riptutorial.com/ko/home 11

.

Xcode .

Bash : http://mattorb.com/xcode-behaviors-for-fun-and-profit/

Open Terminal in current Xcode project folder Open Terminal in current Xcode project folder .

( Xcode ). .

:

#!/bin/bash rm -rf $HOME"/Library/Developer/Xcode/DerivedData/"

Xcode IDE : https://riptutorial.com/ko/xcode/topic/8260/xcode-ide--

https://riptutorial.com/ko/home 12

5: Xcode

Examples

Xcode

. : NSLog NSLog .

https://riptutorial.com/ko/home 13

NSLog .

. bw <# #> .

NSLog .

Xcode 7

Xcode . . .

curl -fsSL https://raw.githubusercontent.com/supermarin/Alcatraz/deploy/Scripts/install.sh |

Xcode .

:

VVDocumenter - / , , ... •

https://riptutorial.com/ko/home 14

XcodeColors - ( : CocoaLumberjack )•FuzzyAutocomplete - "NSog" NSLog .•BuildTimeAnalyzer - Other Swift flags -Xfrontend -debug-time-function-bodies .•

. Apple Xcode 8 (FuzzyAutocomplete VVDocumenter)

+ + 9 + + 9 .

https://riptutorial.com/ko/home 15

Xcode .

Xcode 8 .

Xcode > > .1.

https://riptutorial.com/ko/home 16

OS_ACTIVITY_MODE = disable2.

Xcode : https://riptutorial.com/ko/xcode/topic/3349/xcode-

https://riptutorial.com/ko/home 17

6:

Examples

TargetConditionals

TargetConditionals.h C Objective-C .

#import <TargetConditionals.h> // imported automatically with Foundation - (void)doSomethingPlatformSpecific { #if TARGET_OS_IOS // code that is compiled for iPhone / iPhone Simulator #elif TARGET_OS_MAC && !TARGET_OS_IPHONE // code that is compiled for OS X only #else // code that is compiled for other platforms #endif }

.

7.0

iOS 9.1, tvOS 9.0, watchOS 2.0, OS X 10.11 SDK :

iOS iOS TV TV

TARGET_OS_MAC 1 1 1 1 1 1 1

TARGET_OS_IPHONE 0 1 1 1 1 1 1

TARGET_OS_IOS 0 1 1 0 0 0 0

TARGET_OS_WATCH 0 0 0 1 1 0 0

TARGET_OS_TV 0 0 0 0 0 1 1

TARGET_OS_SIMULATOR 0 0 1 0 1 0 1

TARGET_OS_EMBEDDED 0 1 0 1 0 1 0

TARGET_IPHONE_SIMULATOR 0 0 1 0 1 0 1

7.0

iOS 8.4, OS X 10.10 SDK :

https://riptutorial.com/ko/home 18

7:

Examples

:

: Xcode ( ) .•

: → → ( stepsN) .•

1.

( OS / OS / tvOS) .2.

https://riptutorial.com/ko/home 20

.3.

,

.

x 1 4 .

import UIKit for x in [1, 2, 3, 4] { x }

(1) .

(2) .

(3) ,

https://riptutorial.com/ko/home 21

, ,

, , .

> > (1) .1. .

Resources •Resources File> Add Resources to "Resources" •Control- "" .•

2.

. let i = UIImage(named: "tacos.jpg")3.

: https://riptutorial.com/ko/xcode/topic/1236/

https://riptutorial.com/ko/home 22

8:

Examples

xcode / .

.

.

https://riptutorial.com/ko/home 23

21 38 . 38 Xcode .

https://riptutorial.com/ko/home 24

(Debug Gauges) CPU , . .

Variables View breaded line . , , .

. PO .

.

/ .•/ .•.•Step-In .• .•

: .

.

.

. . .

https://riptutorial.com/ko/home 25

image , path != nil . po _routeStartLocation . po _routeStartLocation .

.

Xcode-9

Apple iOS11 Xcode-9 USB Xcode . Xcode-9 .

Xcode . 1 iOS11 Xcode-9 . 2 Xcode > . 3 .

https://riptutorial.com/ko/home 26

9:

Examples

xcodebuild

( : CocoaPod )

xcodebuild \ -workspace MyApp.xcworkspace \ -scheme "MyScheme" \ -sdk iphonesimulator \ -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1' \ test

xcodebuild \ -project MyApp.xcproj \ -scheme "MyScheme" \ -sdk iphonesimulator \ -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1' \ test

destination .

-destination 'platform=iOS,id=REAL_DEVICE_UDID' -destination 'platform=iOS,name=IPHONE NAME'

, .

xcodebuild -list

xcodebuild -list -workspace ./MyApp.xcworkspace xcodebuild -list -project ./MyApp.xcodeproj

Information about project "Themoji": Targets: Themoji ThemojiUITests Unit Build Configurations: Debug Release If no build configuration is specified and -scheme is not passed then "Release" is used. Schemes: Themoji ThemojiUITests Units

https://riptutorial.com/ko/home 28

iPhone MyProject for schema Qa :

xcrun xcodebuild clean \ -workspace "MyProject.xcworkspace" \ -scheme "YourScheme" \ -sdk iphoneos \ -configuration Debug \ archive \ -archivePath builds/MyProject.xcarchive

Debug Release .

:

xcrun xcodebuild -exportArchive \ -archivePath builds/MyProject-Qa.xcarchive \ -exportOptionsPlist config.plist \ -exportPath builds

config.plist .

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>method</key> <string>development</string> <key>uploadSymbols</key> <true/> </dict> </plist>

plist .

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>teamID</key> <string>xxxxxxxxxxx</string> <key>method</key> <string>app-store</string> <key>uploadSymbols</key> <true/> </dict> </plist>

ID .

compileBitcode•embedOnDemandResourcesAssetPacksInBundle•iCloudContainerEnvironment•manifest•

https://riptutorial.com/ko/home 29

method•onDemandResourcesAssetPacksBaseURL•teamID•thinning•uploadBitcode•uploadSymbols•

xcodebuild --help .

Xcode (xcrun) .

xcrun Xcode ( xcode-select ) Xcode ( : llvm-cov) .

# Generate code coverage reports via llvm-cov # /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin xcrun llvm-cov [parameters] # Execute xcodebuild # /Applications/Xcode.app/Contents/Developer/usr/bin xcrun xcodebuild [parameters] # Use Xcode's version of git, e.g., if you have installed a newer version # /Applications/Xcode.app/Contents/Developer/usr/bin xcrun git [parameters]

xcode-select

( Xcode)

xcode-select -p

Xcode ( : ).

sudo xcode-select -s /Applications/Xcode-beta.app

Xcode

sudo xcode-select -r

sudo xcode-select -s /Applications/Xcode.app .

man xcode-select .

: https://riptutorial.com/ko/xcode/topic/2158/--

https://riptutorial.com/ko/home 30

codesigning fastlane

git repo . Mac . .

.

, : https://riptutorial.com/ko/xcode/topic/3711/------

https://riptutorial.com/ko/home 32

, , ,

R . ( ).

Test (U), Profile (I) Analyze (B) . , ^ ..

.

. . .

. .

() 1 8 0 . 0 . .

+ 1 - .1.

https://riptutorial.com/ko/home 34

+ 2 - .2. + 2 - ( + + F );3. + 4 - , .4. + 5 - .5. + 6 - .6. + 7 - ;7. + 8 - / .8. + 0 - / .9.

1 6 ( : , , XIB ). 0 .

+ 0 + + 0 .

K J .

( , simbols, ).

, , . UINavigationItem UITableViewCell !

( , , ) ^ + + (1 - 4) .

: https://riptutorial.com/ko/xcode/topic/335/---

https://riptutorial.com/ko/home 35

S. No

Contributors

1 Xcode Anh Pham, Community, Jbryson, jtbandes, Md. Ibrahim Hassan, Undo

2@IBDesignable Interface Builder

Echelon

3 Xcode 8 Rashwan L, Sharukh Mastan

4 Xcode IDE Vitaliy Gozhenko

5 Xcode Anand Prem, Finn Gaida, jtbandes, user459460

6 J F, jtbandes

7 Anh Pham, Idan, Rob Wright

8 D4ttatraya

9Ali Beadle, David Snabel-Caunt, Fabio, Idan, Jens Meder, KrauseFx

10 , KrauseFx

11 Eimantas, jtbandes

https://riptutorial.com/ko/home 36