Post

Replies

Boosts

Views

Activity

Unit Test for Multiplatform App on Big Sur
How do I do unit test with multiplatform app? I created a new project and add a class with one object. class MyClass {   static var apples: [Int] = [1,2,3] } When I want to do unit test, it fails ... import XCTest @testable import MyApp class Tests_macOS: XCTestCase { 		func testExample() throws { 				XCTAssertEqual(MyClass.apples.count, 3) 		} } Errors Undefined symbols for architecture x86_64:  "MyApp.MyClass.apples.unsafeMutableAddressor : [Swift.String]", referenced from:    implicit closure #1 () throws -> Swift.Int in Tests_macOS.Tests_macOS.testExample() throws -> () in Tests_macOS.o  "type metadata accessor for MyApp.MyClass", referenced from:    implicit closure #1 () throws -> Swift.Int in Tests_macOS.Tests_macOS.testExample() throws -> () in Tests_macOS.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Undefined symbol: MyApp.MyClass.apples.unsafeMutableAddressor : [Swift.String] Undefined symbol: type metadata accessor for MyApp.MyClass
2
0
2.7k
Oct ’20
UIMenu for Mac Catalyst
I want to put a customer MenuItem under the first tab of the Menus (usually its your App Name). I started with the sample code - https://developer.apple.com/documentation/uikit/uicommand/adding_menus_and_shortcuts_to_the_menu_bar_and_user_interface. However, I only change one line of code, it acts inconsistently in different menu, any idea? UIMenu.Options .displayInline works in menu - File. builder.insertChild(MenuController.openMenu(), atStartOfMenu: .file) UIMenu.Options .displayInline does not work in menu - APP. builder.insertChild(MenuController.openMenu(), atStartOfMenu: .about)
0
0
500
Oct ’20