Posts

Post marked as solved
1 Replies
179 Views
On my M1 mac, using Xcode 13.3, I created a package and displayed the code coverage bar (Editor menu –> Code Coverage). After running tests, there is no indication of code coverage at all in the source code. How do I get code coverage when testing a package?
Posted
by MegaWatt.
Last updated
.
Post not yet marked as solved
1 Replies
106 Views
I created a new Package with Xcode and incorporated a dependency, however when I try to use it, I get a "No such module" error. How do I use the dependency in the Package sources? In a normal project, I can easily import and use AgileDB. Here's the Package: // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package(     name: "DBCore",     products: [         // Products define the executables and libraries a package produces, and make them visible to other packages.         .library(             name: "DBCore",             targets: ["DBCore"]),     ],     dependencies: [   .package(url: "https://github.com/AaronBratcher/AgileDB", from: "6.4.0")     ],     targets: [         // Targets are the basic building blocks of a package. A target can define a module or a test suite.         // Targets can depend on other targets in this package, and on products in packages this package depends on.         .target(             name: "DBCore",             dependencies: []),         .testTarget(             name: "DBCoreTests",             dependencies: ["DBCore"]),     ] ) Perhaps the AgileDB package as a dependency in the target? I tried copying that and it won't recognize it.
Posted
by MegaWatt.
Last updated
.
Post not yet marked as solved
4 Replies
1k Views
When showing an ImageDownloader actor, the presenter said a solution on avoiding duplicate downloads is shown with the code associated with this video. When will this code be available? I don't see it on the video page.
Posted
by MegaWatt.
Last updated
.
Post not yet marked as solved
3 Replies
6.0k Views
I'm trying to swap out the rootViewController in my appDelegate with an animation and it is just flashing to the new viewController without any animation.-(void)showRootController:(UIViewController *)controller { [UIView transitionWithView:self.window duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ self.window.rootViewController = controller; [self.window makeKeyAndVisible]; } completion:nil]; }How can I do this with an animation? (Testing on an iPhone 5s with iOS 8)
Posted
by MegaWatt.
Last updated
.
Post not yet marked as solved
1 Replies
1.4k Views
Using Xcode 11 beta, I'm trying to Add Package Dependency: https://github.com/AaronBratcher/ALBNoSQLDB.git but get an error saying Package Resolution FailedI suspect the Package.swift file I created is improperly defined. Can someone help me get it set properly?Thanks.
Posted
by MegaWatt.
Last updated
.
Post not yet marked as solved
14 Replies
12k Views
I used this script in the post-action of the archive in my scheme to make a FAT binary framework. One that will work on the simulator and actual device.`https://gist.github.com/gauravkeshre/eabb2a13ef6d673fadec84ca60b56b05`Does anyone know how to convert it to work with Xcode 10?Here is the script itself: exec > /tmp/${PROJECT_NAME}_archive.log 2>&1 UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal if [ "true" == ${ALREADYINVOKED:-false} ] then echo "RECURSION: Detected, stopping" else export ALREADYINVOKED="true" # make sure the output directory exists mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" echo "Building for iPhoneSimulator" xcodebuild -workspace "${WORKSPACE_PATH}" -scheme "${TARGET_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone XS' ONLY_ACTIVE_ARCH=NO ARCHS='i386 x86_64' BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" ENABLE_BITCODE=YES OTHER_CFLAGS="-fembed-bitcode" BITCODE_GENERATION_MODE=bitcode clean build # Step 1. Copy the framework structure (from iphoneos build) to the universal folder echo "Copying to output folder" cp -R "${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/${FULL_PRODUCT_NAME}" "${UNIVERSAL_OUTPUTFOLDER}/" # Step 2. Copy Swift modules from iphonesimulator build (if it exists) to the copied framework directory SIMULATOR_SWIFT_MODULES_DIR="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${TARGET_NAME}.framework/Modules/${TARGET_NAME}.swiftmodule/." if [ -d "${SIMULATOR_SWIFT_MODULES_DIR}" ]; then cp -R "${SIMULATOR_SWIFT_MODULES_DIR}" "${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Modules/${TARGET_NAME}.swiftmodule" fi # Step 3. Create universal binary file using lipo and place the combined executable in the copied framework directory echo "Combining executables" lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${EXECUTABLE_PATH}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${EXECUTABLE_PATH}" "${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/${EXECUTABLE_PATH}" # Step 4. Create universal binaries for embedded frameworks # for SUB_FRAMEWORK in $( ls "${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Frameworks" ); do # BINARY_NAME="${SUB_FRAMEWORK%.*}" # lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${SUB_FRAMEWORK}/${BINARY_NAME}" "${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/${TARGET_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}" # done # Step 5. Convenience step to copy the framework to the project's directory echo "Copying to project dir" yes | cp -Rf "${UNIVERSAL_OUTPUTFOLDER}/${FULL_PRODUCT_NAME}" "${PROJECT_DIR}" open "${PROJECT_DIR}" fi
Posted
by MegaWatt.
Last updated
.
Post not yet marked as solved
6 Replies
1.9k Views
I have a framework binary built with Swift that I'm trying to incorporate into an Objective-C project. However the class in the framework isn't available.In the swift framework, the class is defined like this:@objcMembers @objc public final class Messaging: NSObject, UINavigationControllerDelegate, LogsManagerDelegate { ... }I drag the archived and exported framework directly into the project to use and make sure the Defines Module is set to Yes in the Build Settings.In the Objective-C I try to use the framework:@import ContactAtOnceMessaging; @implementation MessagingExperience Messaging *messaging; // Unknown type name 'Messaging' ... @endIf I drag the code for the framework directly into the project, Messaging is a known class so I know the Swift is okay.I also tried changing the import to the following, but that didn't work. #import "ContactAtOnceMessaging/ContactAtOnceMessaging-Swift.h"What am I doing wrong?
Posted
by MegaWatt.
Last updated
.
Post not yet marked as solved
0 Replies
620 Views
When running a unit test without a host application, my code for creating a file is returning something in the CoreSimulator. However that location doesn't necessarily exist.This is my code: let searchPaths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) let documentFolderPath = searchPaths[0] let dbFilePath = documentFolderPath + "/test.db"dbFilePath created: /Users/aaronbratcher/Library/Developer/CoreSimulator/Devices/3E6F7BD3-482B-4A90-B3C7-C0CC8412A5AC/data/Documents/test.dbHow can I get a path outside of CoreSimulator when running unit tests without a host app?
Posted
by MegaWatt.
Last updated
.
Post marked as solved
3 Replies
1.9k Views
I have an Objective-C project with 1 Swift class. This class is using a framework that is also written in Swift. (Used CocoaPods to include the framework)My problem is that the -Swift.h file is exporting my extensions that adhere to protocols in the framework. Now when I try to import the -Swift.h file in the Objective-C, it complains that that the protocol definitions cannot be found.I don't want these extensions exported. They are only used in this class. I can't use private or fileprivate for extensions that declare protocol conformances. I also tried adding @nonobjc before the extension declaration (which cascaded warnings into my methods) and it was still exported.Here are my extensions:extension MessagingExperience: MessagingDelegate { ... } extension MessagingExperience: MessagingNotificationDelegate { ... }And generated header:@interface MessagingExperience (SWIFT_EXTENSION(Reference_App)) <MessagingDelegate> - (void)MessagingObseleteVersion:(NSError * _Nonnull)error; - (void)MessagingError:(NSError * _Nonnull)error; @end @interface MessagingExperience (SWIFT_EXTENSION(Reference_App)) <MessagingNotificationDelegate> - (BOOL)shouldShowMessagingNotificationWithNotification:(MessagingNotification * _Nonnull)notification SWIFT_WARN_UNUSED_RESULT; - (void)messagingNotificationTapped:(MessagingNotification * _Nonnull)notification; - (UIView * _Nonnull)customMessagingNotificationViewWithNotification:(MessagingNotification * _Nonnull)notification SWIFT_WARN_UNUSED_RESULT; @endErrors produced by including the -Swift.h in an Objective-C class:Cannot find protocol declaration for 'MessagingDelegate'Cannot find protocol declaration for 'MessagingNotificationDelegate'Is there a way to prevent this from being in the header?Thanks.
Posted
by MegaWatt.
Last updated
.
Post not yet marked as solved
0 Replies
407 Views
Adding content extension to my app's notification handling. I have it working, but I want to do it without a storyboard directly specified. The reason is that I want the ability to pass this on to a 3rd party framework (that I'm developing) to handle presenting the notification and managing the user response.I tried removing the NSExtensionMainStoryboard entry and adding an NSExtensionPrincipalClass entry so I can load the view in code. However, my class isn't being instantiated. Here's the class definition:class NotificationViewController: NSObject, UNNotificationContentExtension { override init() { super.init() print("extension instantiated") } func didReceive(_ notification: UNNotification) { print("notification received") } }Here's my NSExtension entry:<dict> <key>NSExtensionAttributes</key> <dict> <key>UNNotificationExtensionDefaultContentHidden</key> <true/> <key>UNNotificationExtensionCategory</key> <string>Messaging</string> <key>UNNotificationExtensionInitialContentSizeRatio</key> <real>1</real> </dict> <key>NSExtensionPrincipalClass</key> <string>NotificationViewController</string> <key>NSExtensionPointIdentifier</key> <string>com.apple.usernotifications.content-extension</string> </dict>Has anyone done this for content extensions?
Posted
by MegaWatt.
Last updated
.
Post marked as solved
1 Replies
409 Views
I'm trying to add a split view controller to my existing project so that it shows over the existing content in a new window.The template project from Apple works as expected. For testing, I simply copied the storyboard items from the template project onto my own storyboard, gave the splitViewController a storyboard identifier and copied the classes.When a plus phone is turned landscape it shows the master and detail side-by-side properly. However, when I tap on a master entry it pushes a *new* detail controller instance over the master content instead of using the secondary detail view on the right for the content.This is how I show show the splitViewController: guard let splitViewController = storyboard.instantiateViewController(withIdentifier: "MasterViewController") as? UISplitViewController else { return } splitViewController.delegate = self splitViewController.preferredDisplayMode = .automatic self.conversationWindow = UIWindow(frame: UIScreen.main.bounds) self.conversationWindow?.windowLevel = UIWindowLevelNormal + 0.1 self.conversationWindow?.rootViewController = splitViewController self.conversationWindow?.makeKeyAndVisible()Anyone ever experience this?Also posted here with images: https://stackoverflow.com/questions/47559230/uisplitviewcontroller-pushes-new-detail-controller-doesnt-update-side-detail
Posted
by MegaWatt.
Last updated
.