How can a command line tool print the help text and automatically get the behavior with piping to the more command?
With the command line tools I've built with Swift in Xcode there is an option to print the help text. When there is more text than the height of the terminal window it scrolls past the start of the help text. When viewing man pages the text is automatically paged like it is using the more
command.
Is there a way to get this behavior with a command line tool built in Xcode?
See also questions close to this topic
-
ARKit – Adding box to anchor?
I wanted to create a simple object (box) and display it at a position, but everything I can find is about using the
renderer()
method.Is there a simpler way to just use an anchor? And just add the anchor to my
SCNBox
object?let rect = SCNBox(width: 10.0, height: 10.0, length: 10.0, chamferRadius: 0) rect.firstMaterial?.diffuse.contents = UIImage(named: "test.png") let anchor = ARWorldAnchor( /* ... created with 4 columns */ ) // here how to add the rect object to the anchor ? session.add(anchor: anchor)
-
SwiftUI macOS view starts lagging when displaying multiple charts
I am displaying multiple charts in a view.
The charts are just paths in a frame and data comes from an csv file (not bigger than 400mb).
Those charts are displayed inside of a LazyVGrid and the whole view is inside a scroll view.Loading the view takes about 10 - 20 seconds, but when I start scrolling through the charts, it becomes very laggy.
To solve this I tried to attach .drawingGroup() to the chart views, but there where nearly no performance change.the code looks something like this:
import SwiftUI struct GroupView: View { @State var chartData = [CGFloat]() let columns = [ GridItem(.adaptive(minimum: 720)) ] var body: some View { VStack{ ScrollView { LazyVGrid(columns: columns){ CSVChart(data: chartData, chartName: String, x-yaxisName: [String](), lineColor: CGColor) .frame(width: 700, height: 300, alignment: .center) .drawingGroup() // there is as well no performance change when .drawingGroup() is inside the chart view } } }.onAppear{ chartData = // get csv data logic } } }
I know that the csv file is quite large, and that this will cause the slow behaviour, but I thought that other apps aren't that laggy when working with large files so this might be fixable.
It would be great if someone could help me with this problem. -
XCFramework's .swiftinterface breaks compile when imported with Swift Package Manager
Created a Swift Package (// swift-tools-version:5.3.0) for an XCFramework. The package has dependencies on 4 other Swift packages (2 of them using swift-tools-version < 5 and 2 are >= 5.0). It builds and runs in the project's Demo app target. The generated XCFramework copied into a Swift Package repo and hosted on GitHub.
I then create a new project and the Swift Package can be successfully imported into it thru SPM. The dependencies are also imported.
When building the new project, my framework fails to compile due to an error in my framework's generated .swiftinterface file, 'XMLIndexerDeserializable' is not a member type of 'SWXMLHash':
Can anyone shed some light on this failure? Not sure if it an issue with my packaged framework, a config issue with the new project that imports it, or an error due to the difference in the Swift tools version of the dependencies.
Some Background Details On My Config and Process
My Swift Package config:
// swift-tools-version:5.3.0 import PackageDescription let package = Package( name: "MyPackage", platforms: [ .iOS(.v9) ], products: [ .library( name: "MyPackage", targets: ["MyPackage"]) ], dependencies: [ .package(name: "CryptoSwift", url: "https://github.com/krzyzanowskim/CryptoSwift", .upToNextMinor(from: "1.2.0")), .package(name: "Alamofire", url: "https://github.com/Alamofire/Alamofire", .upToNextMinor(from: "4.8.2")), .package(name: "AEXML", url: "https://github.com/tadija/AEXML", .upToNextMinor(from: "4.4.0")), .package(name: "SWXMLHash", url: "https://github.com/drmohundro/SWXMLHash", .upToNextMinor(from: "4.9.0")) ], targets: [ .binaryTarget( name: "MyPackage", path: "MyPackage.xcframework") ] )
Watched the WWDC 2019 and 2020 sessions on building XCFrameworks/binaries for SPM, along with other various tutorials. Used the following sh script to build the XCFramework that would be used for my hosted Swift Package:
xcodebuild archive \ -scheme MyPackage \ -sdk iphoneos \ -archivePath "./XCFrameworkArchives/ios_devices.xcarchive" \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ SKIP_INSTALL=NO xcodebuild archive \ -scheme MyPackage \ -sdk iphonesimulator \ -archivePath "./XCFrameworkArchives/ios_simulators.xcarchive" \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ SKIP_INSTALL=NO xcodebuild -create-xcframework \ -framework ./XCFrameworkArchives/ios_devices.xcarchive/Products/Library/Frameworks/MyPackage.framework \ -framework ./XCFrameworkArchives/ios_simulators.xcarchive/Products/Library/Frameworks/MyPackage.framework \ -output ./XCFrameworkArchives/MyPackage.xcframework
The XCFramework is copied into my Swift Package repo, pushed up to GitHub and tagged.
I then created a new project, used SPM to add a dependency and pulled in MyPackage along with it's dependencies.
Add code to import MyPackage and make use of it. Attempt to build the project throws the compile error that lead me to ask for help. If you can help and need more info, happy clarify and provide more info if I can.
-
React Native App won't start on new m1 laptop
I've tried everything i could find, from running it totally from the Rosetta terminal to trying some workarounds on Xcode, but the farthest i got was running the project with
react-native run-ios
and getting stuck at the first line which is:info Found Xcode workspace "test.xcworkspace"
-
SWIFT: Disable captions button in AVPlayer
I have by trying to find a way to remove the CC button from the AVPlayer's view. This one, to be exact:
After doing research, i found some answers pointing out that this particular button cannot be removed from the default player, unless i implement custom controls. Does anyone know of a way to remove this button without implementing custom controls? Thank you
-
"Set :CFBundleVersion $buildNumber" not setting incremented build number in XCode 12
I have added the following script to increment my build number in XCode 12 under build phases
#!/bin/bash buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}") buildNumber=$(($buildNumber + 1)) /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${INFOPLIST_FILE}"
But the build number is not getting incremented. When I used an alternative script, the build number was incrementing incorrectly and ranging between 0000 to 0006. I don't really want the leading zeros but at least this script was changing the build which is why I am listing it here.
#!/bin/bash buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE") buildNumber=$(($buildNumber + 1)) buildNumber=$(printf "%04d" $buildNumber) /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
Can someone tell me what's the issue with the first script? It used to work in the past. And I have ensured that xcode is pointing to the correct
Info.plist
file. -
Using Old Mac as Server
I am building a web-app and on my server, I need to execute some xcode-command-line-tools, so basically I come up with this architecture :
Frontend(React) --> NodeJS(Ubuntu) --> MacStadium(DedicatedHostedServer) --> NodeJS(Ubuntu) --> Frontend(React)
So in my dedicated MacStadium I was doing the small Xcode stuff and return it to my node server. Since MacStadium is very expensive and I don't profit from the website I was wondering if it is possible to use an old iMac I have together with my home connection and macOSServer APP to host my API and replace the MacStadium. If Yes do you have any resources that explain it?
Thanks in advance
-
VSCode C++ Include Error . Please update your includePath . MacOS BigSur
My Code :-
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; cout<<t; }
I am getting an error on the 1st line of the code (#include <bits/stdc++.h>) saying the following :
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit
This is what my C++ Properties file looks like:-
{ "configurations": [ { "name": "Mac", "includePath": [ "${workspaceFolder}/**" ], "defines": [], "macFrameworkPath": [], "compilerPath": "/usr/bin/g++", "cStandard": "gnu17", "cppStandard": "gnu++14", "intelliSenseMode": "gcc-x64" } ], "version": 4 }
The Error has been popping up since I have updated my Mac commmand line tools .
I have tried changing my includePath to /inc but that still doesn’t fix the problem.