Post

Replies

Boosts

Views

Created

Wrong SF symbol displayed
Hi there! After a few months off, I'm starting a new app. I'm making a TabView like this: import SwiftUI struct ContentView: View {     @State private var tab: Tab = .adventures     var body: some View {         TabView(selection: $tab) {                         Text("Explore")                 .tag(Tab.explore)                 .tabItem {                     Label("Explore", systemImage: "airplane.circle")                 }             Text("Profile")                 .tag(Tab.profile)                 .tabItem {                     Label("Profile", systemImage: "person")                 }         }     }     enum Tab {         case explore, profile     } } As you noticed, I want airplane.circle and person SF Symbols on the TabView but SwiftUI is showing airplane.circle.fill and person.fill in the preview canvas and also when I run the app in the simulator. Why it is forcing me to show those icons? Xcode version: 13.4.1 SF Symbols version: 3.3 iOS deployment target: 15.0 Thank you.
2
0
1.5k
Sep ’22
How can I set Dark Mode in Swift UI Tests?
HI there, I've been researching for a few days whether it's possible or not to programmatically activate Dark Mode within a Swift UI Test. Environment: Xcode 12.5.1 What I'm trying to achieve is: I'm using Fastlane to automate screenshots, so I would like to take one screenshot per device in dark mode. I know that Fastlane supports dark mode passing the dark_mode argument, but this will take all screenshots in dark mode. I'm looking for something like this:     func testExample() throws {         let app = XCUIApplication()         setupSnapshot(app)  // Set up Fastlane snapshot         app.launch()         // Take first screenshot in light mode         snapshot("1Launch")         // Do something to enable dark mode // Take second screenshot in dark mode         snapshot("1LaunchDarkMode") } What I've tried so far: func testAppleInterfaceStyleDark() { let app = XCUIApplication() var launchArguments: [AnyHashable] = [] launchArguments.append("-AppleInterfaceStyle") launchArguments.append("Dark") app.launchArguments = launchArguments as! [String] app.launch() } As suggested in this Stackoverflow answer. But for me, It doesn't work. While researching, I found lots of questions like mine but without answer. Like this one. What makes me wonder if it's impossible to do. I would like to know if it's impossible to stop wasting time on this, or if it's possible, how can I solve it? Thank you.
2
0
2.3k
Aug ’21
Build Xcode project in server without signing certificate
Hello guys! I published my first open source project to Swift Package Index and, as you know, this website builds each project to show a full compatibility report. The problem is, when my project is built in iOS to check if it's compatible with Swift 5.1 I get the following error error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "" with a private key was found. (in target 'StockCharts' from project 'StockCharts') I'm still a newbie but I think it's because a Team ID is assigned to the project in Xcode, and when the server wants to build the project It needs a signing certificate, which obviously it's not in the server. The command that the server uses to build the project is xcrun xcodebuild -IDEClonedSourcePackagesDirPathOverride="$PWD/.dependencies" -derivedDataPath "$PWD/.derivedData" build -scheme "StockCharts" -destination "generic/platform=ios" I think that I have to change something in the project settings but I do not what. Could you give some ideas? Thank you.
1
0
3.2k
May ’21
Layout constraint warning using .navigationTitle
I've notice that .navigationTitle(_:) always causes layout constraints warnings. Given this example, which is in Apple documentation - https://developer.apple.com/documentation/swiftui/navigationview you can check that the layout constraint warning appears only when .navigationTitle(_:) is added. Here is the sample code: swift struct DestinationPageView: View { var color: Color var body: some View { Text("Destination Page") .font(.title) .foregroundColor(color) } } struct ContentView: View { var body: some View { NavigationView { List { NavigationLink( destination: DestinationPageView(color: .purple) ) { Text("Purple Page") } NavigationLink( destination: DestinationPageView(color: .pink) ) { Text("Pink Page") } NavigationLink( destination: DestinationPageView(color: .orange) ) { Text("Orange Page") } } .navigationTitle("Title") } } } Notice that the same warning appears when I use .navigationBarTitle(_:) which is deprecated - https://developer.apple.com/documentation/swiftui/view/navigationbartitle(_:-6p1k7) by the way. This stack overflow post - https://stackoverflow.com/questions/65223457/navigationtitle-aways-creates-an-autolayout-constraint-conflict is the most recent about this issue but there is no much information. I just wondering if is something wrong with the code or it's just a bug. Is there any workaround to avoid this warning?
3
0
1.7k
Feb ’21
Having issues with DatePicker iOS14
Hi guys! I'm trying to implement a DatePicker in my app, everything works find except for one thing. When I select the DatePicker I receive this huge warning (I attached a text file that contains the full warning). [LayoutConstraints] Unable to simultaneously satisfy constraints. This is only the first part of the warning. Please check the full error attached. Full error - https://developer.apple.com/forums/content/attachment/6491a943-116e-4154-aca7-076ce4742ec9 On an iPhone, the DatePicker looks good but on an iPad it is very small relative to the iPad screen. This is my code // Date picker DatePicker(selection: $selectedDate, in: ...Date(), displayedComponents: .date) { Text("") } .padding(.trailing) .onChange(of: self.selectedDate, perform: { date in // Do something }) Any ideas about the error? Thank you.
3
1
2.6k
Nov ’20
Wrong SF symbol displayed
Hi there! After a few months off, I'm starting a new app. I'm making a TabView like this: import SwiftUI struct ContentView: View {     @State private var tab: Tab = .adventures     var body: some View {         TabView(selection: $tab) {                         Text("Explore")                 .tag(Tab.explore)                 .tabItem {                     Label("Explore", systemImage: "airplane.circle")                 }             Text("Profile")                 .tag(Tab.profile)                 .tabItem {                     Label("Profile", systemImage: "person")                 }         }     }     enum Tab {         case explore, profile     } } As you noticed, I want airplane.circle and person SF Symbols on the TabView but SwiftUI is showing airplane.circle.fill and person.fill in the preview canvas and also when I run the app in the simulator. Why it is forcing me to show those icons? Xcode version: 13.4.1 SF Symbols version: 3.3 iOS deployment target: 15.0 Thank you.
Replies
2
Boosts
0
Views
1.5k
Activity
Sep ’22
How can I set Dark Mode in Swift UI Tests?
HI there, I've been researching for a few days whether it's possible or not to programmatically activate Dark Mode within a Swift UI Test. Environment: Xcode 12.5.1 What I'm trying to achieve is: I'm using Fastlane to automate screenshots, so I would like to take one screenshot per device in dark mode. I know that Fastlane supports dark mode passing the dark_mode argument, but this will take all screenshots in dark mode. I'm looking for something like this:     func testExample() throws {         let app = XCUIApplication()         setupSnapshot(app)  // Set up Fastlane snapshot         app.launch()         // Take first screenshot in light mode         snapshot("1Launch")         // Do something to enable dark mode // Take second screenshot in dark mode         snapshot("1LaunchDarkMode") } What I've tried so far: func testAppleInterfaceStyleDark() { let app = XCUIApplication() var launchArguments: [AnyHashable] = [] launchArguments.append("-AppleInterfaceStyle") launchArguments.append("Dark") app.launchArguments = launchArguments as! [String] app.launch() } As suggested in this Stackoverflow answer. But for me, It doesn't work. While researching, I found lots of questions like mine but without answer. Like this one. What makes me wonder if it's impossible to do. I would like to know if it's impossible to stop wasting time on this, or if it's possible, how can I solve it? Thank you.
Replies
2
Boosts
0
Views
2.3k
Activity
Aug ’21
Build Xcode project in server without signing certificate
Hello guys! I published my first open source project to Swift Package Index and, as you know, this website builds each project to show a full compatibility report. The problem is, when my project is built in iOS to check if it's compatible with Swift 5.1 I get the following error error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "" with a private key was found. (in target 'StockCharts' from project 'StockCharts') I'm still a newbie but I think it's because a Team ID is assigned to the project in Xcode, and when the server wants to build the project It needs a signing certificate, which obviously it's not in the server. The command that the server uses to build the project is xcrun xcodebuild -IDEClonedSourcePackagesDirPathOverride="$PWD/.dependencies" -derivedDataPath "$PWD/.derivedData" build -scheme "StockCharts" -destination "generic/platform=ios" I think that I have to change something in the project settings but I do not what. Could you give some ideas? Thank you.
Replies
1
Boosts
0
Views
3.2k
Activity
May ’21
Layout constraint warning using .navigationTitle
I've notice that .navigationTitle(_:) always causes layout constraints warnings. Given this example, which is in Apple documentation - https://developer.apple.com/documentation/swiftui/navigationview you can check that the layout constraint warning appears only when .navigationTitle(_:) is added. Here is the sample code: swift struct DestinationPageView: View { var color: Color var body: some View { Text("Destination Page") .font(.title) .foregroundColor(color) } } struct ContentView: View { var body: some View { NavigationView { List { NavigationLink( destination: DestinationPageView(color: .purple) ) { Text("Purple Page") } NavigationLink( destination: DestinationPageView(color: .pink) ) { Text("Pink Page") } NavigationLink( destination: DestinationPageView(color: .orange) ) { Text("Orange Page") } } .navigationTitle("Title") } } } Notice that the same warning appears when I use .navigationBarTitle(_:) which is deprecated - https://developer.apple.com/documentation/swiftui/view/navigationbartitle(_:-6p1k7) by the way. This stack overflow post - https://stackoverflow.com/questions/65223457/navigationtitle-aways-creates-an-autolayout-constraint-conflict is the most recent about this issue but there is no much information. I just wondering if is something wrong with the code or it's just a bug. Is there any workaround to avoid this warning?
Replies
3
Boosts
0
Views
1.7k
Activity
Feb ’21
Having issues with DatePicker iOS14
Hi guys! I'm trying to implement a DatePicker in my app, everything works find except for one thing. When I select the DatePicker I receive this huge warning (I attached a text file that contains the full warning). [LayoutConstraints] Unable to simultaneously satisfy constraints. This is only the first part of the warning. Please check the full error attached. Full error - https://developer.apple.com/forums/content/attachment/6491a943-116e-4154-aca7-076ce4742ec9 On an iPhone, the DatePicker looks good but on an iPad it is very small relative to the iPad screen. This is my code // Date picker DatePicker(selection: $selectedDate, in: ...Date(), displayedComponents: .date) { Text("") } .padding(.trailing) .onChange(of: self.selectedDate, perform: { date in // Do something }) Any ideas about the error? Thank you.
Replies
3
Boosts
1
Views
2.6k
Activity
Nov ’20