I've been playing around with SwiftUI and I'm noticing all these tutorials mentioning to Command-Click Text for example and expecting the following menu items to appear in order to Embed in HStack for example:
The problem is I'm not seeing any of these "Embed in H/VStack" menu items appear. Even if I search for "Embed" it doesn't return anything.
This is what I'm seeing:
I'm on:
Mojave 10.14.6 (18G95).
Xcode Version 11.0 (11A420a).
Being on Catalina (10.15.4 (19E287)) and Xcode (11.4 (11E146)), I've had the same problem.
I've noticed that the requested embed menu appears only when the Canvas is enabled (Editor > Canvas).
You must have the canvas open for the "Embed in H/VStack" menu items to appear.
Press Command + Option + Enter to open the canvas and then select the code you want to embed and then Hold Command + Left Click to try again.
Confirmed on Catalina (10.15.5) and Xcode (11.6)
I have discovered this happen because the Canva it is close, just return it by "Command + Option + Enter" and try again.
This works for me and I hope works for you!
SwiftUI previews and inspectors are only available when running on macOS Catalina 10.15.
https://developer.apple.com/documentation/xcode_release_notes/xcode_11_release_notes?language=objc
I've never seen them as shown but they do exist for me in Xcode 11.4.1 under Show Code Actions rather than Refactor.
The shortcut to get there is [Command][Shift][Left Click] on a SwiftUI element.
This is actually a defect in Xcode I believe. It happens in the 12 betas as well. For me it seems to come and go. The same project will work and then 5 minutes later refuse to shot it in the same project/file. I reported it to Apple but so far no response.
I run multiple simulator and I need to close one of them. How can i do this? Because I tried to close it like we does in older version of Xcode but can't close.
Select Simulator.. Go into File Menu -> Close window or press [Command + W ]. It will close the simulator which is on top .
Go into Windows menu -> uncheck Show Device Bezels. Then you can close using red cross icon on simulator.
There are two ways to close particular Simulator form Multiple simulators
Long-press power button on the right-top of simulator , then slide to turn off power, a single simulator will be close.
Go into File Menu -> Close window or press [Command + W ]. It will close the simulator which is on top
1) Simple way to close single simulator
-> Select required Simulator
-> Click Command + W (⌘W).
2) If you want to minimise simulator
-> Select required simulator
-> Click Command + M (⌘M).
3) For screen shot of simulator
--> Select required simulator
-->Select Commend + S (⌘S).
4) If you want to rotate simulator(for landscape mode)
-> Select required simulator
-> Click Command + left arrow or right arrow.
See below screen for left arrow or right arrow
To long-press power button on the right-top of simulator , then slide to turn off power, a single simulator will be close.
I found a way, but it was by a program I used called HyperDock. It gives a preview of the app windows that are opened when you hover over the icon in the dock. It will give you an option to close the simulator window when you see the preview.
Click Simulator. Open simulator dropdown from the top menu. Click on quit simulator
I have installed xcode 7 and run many apps on the same. But suddenly when i restart the xcode it hides the device header and run icons in top left bar.
Thanks in advance for help !
This is a exsisting bug with XCode 7 I see on our systems.
It happens when more than one project are open at a time.
The first Window will keep its bar, but all other will open without it. Sometimes hiding/showing the toolbar help, but that works only two times or so. Then a restart of XCode is the only cure.
Apparently you hid the toolbar. To reenable it: Select View -> Show Toolbar
I created the applications using Xcode 5[IOS 7].I used the custom font for this applications.
While i run the application in IOS 7 the label alignment good.But when i run the same application IOS 6 the label alignment wont align properly.
iOS 7
iOS 6.
kindly give me the solutions.
You have to go with below step:
step (1)
Uncheck mark Autolayout field.
step (2)
From your nib file set value of that UILable is: "Y" = -20;
may be it will help.
This problem is pretty much weird but has a simple solution.I had been facing the same problem too.
Click on the label and then autoresize it by clicking Command key icon ⌘ (Command key) and the = (equal to) sign together.
This should autofit the label.
I want to take a screenshot of my iOS application when it is running in the simulator, and save the screenshot on my Mac. How can I do this?
It's just as simple as command+s or File > Save Screen Shot in iOS Simulator. It will appear on your desktop by default.
An update with Xcode 11.4 simulator
To capture a screen shot, click on 'Camera' icon/action button, on the top bar of simulator.
OR
Select Save Screen Shot menu item, from File menu.
File => Save Screen Shot
Use ⌘ + S to capture a screen shot.
(Use window + s, if you are using windows/non-apple keyboard).
See for more details: How to change simulator scale options with Xcode 9+.
Tip 1: How do you get screen shot with 100% (a scale with actual device size) that can be uploaded on AppStore?
Disable Optimize Rendering for Window scale from Debug menu, before you take a screen shot.
Here is an option
Menubar ▶ Debug ▶ Disable "Optimize Rendering for Window scale"
Tip 2: Where is screen shot saved (Default Path)? How to change default path?
Simulator saves screen shot file on (logged-in user's) desktop and it's default path.
To change default path (with Xcode 9+), press and hold ⌥ Option (alt) button from keyboard, while you take a screen shot. Or
Using Mac Keyboad: Press keys ⌥ Option + ⌘ + s all together.
It will show to a dialog with file storage options and also allows to set/change default path.
Tip 3: How to take a screen shot with Device Bezel?
Enable Show Device Bezel from Window menu.
Here is an option
Menubar ▶ Window ▶ Enable "Show Device Bezel"
Now,
Press ⌘ + shift + 4 + Spacebar, all together in Mac Keyboard. (A window snap capture mode will become active)
Select Simulator window/frame, that you want to capture. It will save screenshot with device bezel (with shadow effect in background) on (logged-in user's) desktop.
You can also remove the Simulator toolbar as described here.
on iOS Simulator,
Press Command + control + c or from menu : Edit>Copy Screen
open "Preview" app, Press Command + n or from menu : File> New from clipboard
, then you can save command+s
For Retina, activate iOS Simulator then on menu:HardWare>Device>iPhone (Retina)
and follow above process
Command + S
is the way to save on Desktop, (on new iPhone simulators, this was introduced in later simulator)
Press Command+Shift+4 and then keep the mouse pointer on Simulator and then press "Space Bar" key one camera icon will appear, now left click the mouse. Your simulator screen shot is saved on desktop. You can take the screen shot any small screen in the same way.
You can google for IOS Simulator Cropper software useful for capturing screen shots and also easy to use with various options of taking snapshots like with simulator/without simulator.
Update
Just pressing CMD + S will give you screenshot saved on desktop. Pretty easy huh..
Since Xcode 8.2, you can also save a screenshot with the following command:
xcrun simctl io booted screenshot
Further information in this blog: https://medium.com/#hollanderbart/new-features-in-xcode-8-2-simulator-fc64a4014a5f#.bzuaf5gp0
Focus simulator
Go to menu File->Save Screen Shot
or
Press ⌘+S
Screen shot saves in desktop
Simple answer with sample answer ;-)
on iOS Simulator,
Press Command + control + c or from menu : Edit>Copy Screen
open "Preview" app, Press Command + n or from menu : File> New from clipboard , then you can save Command + s
UnCheck Alpha
You can change Image dimension to your requirement.
Here is the Final Image,For example
For some reason the commands posted before dont work for me, but this one does:
xcrun simctl io booted screenshot screenshot.png
Running Xcode 9.2
First, run the app on simulator.
Then, use command+s, or File -> Save Screenshot in Simulator to take necessary and appropriate shots.
The screenshots will appear on your desktop by default.
2020 Latest Update: XCode 11.4
Click on the camera icon above simulator to capture screenshot and save to your camera roll
Another option:
File > Save Screen from simulator
For people using Xcode 11.4, to get rid of the simulator top bar, this is far from ideal but you can disable shadows for the screenshot application in a terminal with the following command :
$ defaults write com.apple.screencapture disable-shadow -bool TRUE; killall SystemUIServer
Then, you can use ⌘ + ⇧ + 4 and select the simulator to take a screenshot. Without the shadow, you can easily crop the top bar with the preview app. To re-enable the shadow for the screenshot application :
$ defaults write com.apple.screencapture disable-shadow -bool FALSE; killall SystemUIServer
Source of this answer here.
In OSX Captain its a bug to take screenshot of simulator. You have to Update your OSX Sierra first then your are able to take. while taking in OSX Captain use terminal command which is xcrun simctl io booted screenshot.
before running this command u have to select desktop in terminal like:
"cd desktop" then run that command. Happy Coding!!!
Screenshot with device frame
Step - 1
Open quick time player
Step - 2
Tap new screen recording
Step - 3
Select Capture selected window
Step - 4
Cursor point on the simulator. It will automatically select the whole simulator like
Step - 5
Screenshot will open using preview. save it.
Here is some sample screenshot
Click CMD+SHIFT+4.
Put mouse over Simulator.
Press SPACE to select whole Window.
Press ALT+Enter to capture simulator window with no shadow.
Remove top bar from screenshot in GIMP or double click on screenshot preview to edit.
I found no way to hide top window bar and screenshot nice phone image with shadow. Apple rox ;-)
Press ⌘S or go to File > Save screenshot from your simulator menu and you will get the screenshot saved on your desktop.
First method:
Select simulator and press "command + s" button. Screenshot saved on desktop.
Second method:
Select simulator and go to "File > New Screenshot". Screenshot saved on desktop.
In case using XCUITests automation :
XCUIApplication().buttons["Add"].screenshot()
XCUIApplication().table["names"].screenshot()
API details : https://developer.apple.com/documentation/xctest/xcuiscreenshot
If you want to attach the device frame to your screenshot, use
xcrun simctl io booted screenshot shot.png && curl -F 'file=#shot.png' "https://shot.withfra.me/new"
It uploads the screenshot to a third party (WithFrame) that adds the device frame.
More info can be found here
Taking Screen Shot in IOS Simulator is SO Simple.
When you Open Simulator In the Right Lift You See File.
Click On File And You See Option Save Screen Shot.
This Option Saves Your Screen Shot In Default Path Which is Desktop.