Post not yet marked as solved
On the Apple Watch, if you go to Settings -> Wake Screen and then scroll down to ON SCREEN RAISE SHOW LAST APP. Underneath it is a list/table where the items are grouped, the first and last items have a rounded rectangle whereas the items in the middle are just rectangles. I would like to use this UI element as well when I present the user a list that functions like a radio button list. Do you know what this UI element is called? Is it just a List but with a specific list style? Thanks.
Post not yet marked as solved
I had a working Watch up until the recent Catalina update, which broke Xcode as it didn't have support files for iPhone 11. I updated to Xcode 11.2 and now it compiles my app but when it tries to install to my Series 3 watch I get this error:Details
Unable to install "[app name] WatchKit App"
Domain: com.apple.dtdevicekit
Code: -402653057
--
App installation failed
Domain: com.apple.dtdevicekit
Code: -402653057
Failure Reason: Device doesn’t support wireless sync.
User Info: {
DVTRadarComponentKey = 487927;
"com.apple.dtdevicekit.stacktrace" = (
0 DTDeviceKitBase 0x000000012875c6e7 DTDKCreateNSError + 109
1 DTDeviceKitBase 0x000000012875cde9 DTDK_AMDErrorToNSError + 792
2 DTDeviceKitBase 0x000000012879c56a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164
3 DVTFoundation 0x000000010fd9c156 DVTInvokeWithStrongOwnership + 73
4 DTDeviceKitBase 0x000000012879c301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589
5 IDEiOSSupportCore 0x0000000128635a25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523
6 DVTFoundation 0x000000010fecd3ba __DVT_CALLING_CLIENT_BLOCK__ + 7
7 DVTFoundation 0x000000010fecea92 __DVTDispatchAsync_block_invoke + 809
8 libdispatch.dylib 0x00007fff71cfb583 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x00007fff71cfc50e _dispatch_client_callout + 8
10 libdispatch.dylib 0x00007fff71d01ace _dispatch_lane_serial_drain + 597
11 libdispatch.dylib 0x00007fff71d02452 _dispatch_lane_invoke + 363
12 libdispatch.dylib 0x00007fff71d0ba9e _dispatch_workloop_worker_thread + 598
13 libsystem_pthread.dylib 0x00007fff71f5571b _pthread_wqthread + 290
14 libsystem_pthread.dylib 0x00007fff71f5557b start_wqthread + 15
);
}
--Has anyone else got a similar issue since the update?
Post not yet marked as solved
public var body: some View
{
ZStack{
GeometryReader { geometry in
RoundedRectangle(cornerRadius: 25, style: .continuous)
.frame(width: geometry.size.width*1.00, height: geometry.size.height*1.00)
.zIndex(0)
}
}
}I'm using GeometryReader to draw a rounded rectangle to fill up the entire watch screen, this looks fine on a 38mm watch simulator, but as I increase the watch size to 40, 42, 44mm I noticed that the height is not filling up the whole screen. I have to adjust my multiple to say 1.1 for example to fill up more of the screen.Can someone tell me if I am using GeometryReader incorrectly?
Post not yet marked as solved
.contextMenu(menuItems: {Button(action: {
tangoArray[randomNum].bookmark.toggle()
database.updateUserData(tango: tangoArray[randomNum])
self.fullRotation.toggle()
}, label: {
VStack{
Image(systemName: tangoArray[randomNum].bookmark ? "bookmark" : "bookmark.fill")
.font(.title)
Text(tangoArray[randomNum].bookmark ? "Remove bookmark" : "Bookmark")
}
})
})I'm trying to use a contextMenu to bookmark flashcard items. What I have found though is that even after randonNum has changed, so adifferent flashcard is presented, the bookmark in the context menu is still showing the previous card's status. For example, it's a filled bookmark if I just tagged the previous card as a bookmark.
Post not yet marked as solved
public struct Frontside: View
{
@Binding public var id: Int
@Binding public var sheet: Bool
@Binding public var rotate: Bool
public var body: some View
{
ZStack{
RoundedRectangle(cornerRadius: 8, style: .continuous)
.foregroundColor(backgroundColours[tangoArray[self.id].jlptColour ?? 0])
.frame(width: 140, height: 149)
.zIndex(0)
VStack {
Text(tangoArray[self.id].kanji)
.font(.system(size: 24))
.foregroundColor(textColours[tangoArray[self.id].jlptColour ?? 0])
.fontWeight(.regular)
.padding(25)
.lineLimit(3)
.truncationMode(.tail)
.zIndex(1)
Spacer()
}
VStack {
Spacer()
HStack {
Button(action: {
incorrect(i: self.id)
checkAttempts()
self.id = nextCard()
if justFinishedRevising {
self.rotate.toggle()
justFinishedRevising = false
}
if justFinishedLearning {
self.rotate.toggle()
self.sheet = true
justFinishedLearning = false
}
}) {
Image(systemName: "xmark")
.font(.headline)
.opacity(0.4)
}
Button(action: {
correct(i: self.id)
checkAttempts()
self.id = nextCard()
if justFinishedRevising {
self.rotate.toggle()
justFinishedRevising = false
}
if justFinishedLearning {
self.sheet = true
justFinishedLearning = false
}
}) {
Image(systemName: "circle")
.font(.headline)
.opacity(0.4)
}
}
}
.zIndex(2)
}
}
}I have a view which is a flashcard. When the user taps on the incorrect button I want the flash card to slide to the left of the screen, and when the user taps on the correct button I want the flash card to transition/slide to the right of the watch screen. How do I do that?
Post not yet marked as solved
.navigationBarTitle("Study")It defaults to a greyish colour, if I wanted to change the colour what do I need to add? Thanks.
Post not yet marked as solved
Hi,What's the easiest way to create either a Rectangle or RoundedRectangle that will fill the entire area of the watch face? I don't want to just flood the whole screen in a colour, because I want to round the corners of my background rectangle which will be the bottom layer in my ZStack.I also want to make my app scalable across different watch sizes from 38mm to 44mm, hence I can't use maxWidth maxHeight. Is there a way to set percentage of the screen?
Post not yet marked as solved
I've just updated to the latest Xcode 11 GM and it has broken my code. I have this HStack as follows:HStack {
Image(systemName: "rectangle.on.rectangle.angled")
Text(verbatim: "Study")
.listRowPlatterColor(Color.gray)
.frame(height:50)
}But in the latest version I am getting this error:Cannot convert value of type 'TupleView<(Image, some View)>' to closure result type '_'What do I need to do to make HStack comply with the latest syntax?
Post not yet marked as solved
I have the following SwiftUI view:struct Flashcard : View {
@State var cardText = newArray[randomNum].kana
var body: some View {
let stack = VStack{
Text(cardText)
.color(.red)
.font(.title)
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: 200)
.tapAction {
self.flipCard()
}
HStack {
Button(action: {
print("button pressed")
self.incorrect()
}) {
Image(systemName: "xmark.circle")
.font(.title)
}
.opacity(0.4)
Button(action: {
print("button pressed")
self.correct()
}) {
Image(systemName: "checkmark.circle")
.font(.title)
}
.opacity(0.4)
}
}
//.background(Color.blue)
.cornerRadius(25)
return stack
}I'm trying to make the background colour of the VStack blue, but when I do that, I realise that the Buttons are no longer pressable. Is there a way to make them always on top? Should I be using a ZStack as well to make the Buttons the last view that is added to the stack? I tried using a ZStack but getting a lot of strange outcomes.
Post not yet marked as solved
Hi,I believe NavigationView is not available on SwiftUI for the Watch. What would I use in its place? I have a menu list which I want to add enable each item to be pressed to move to another view.import SwiftUI
struct ContentView : View {
var body: some View {
List {
HStack {
Image(systemName: "rectangle.on.rectangle.angled")
Text("Study")
.listRowPlatterColor(Color.gray)
.frame(height:50)
}
HStack {
Image(systemName: "star.fill")
Text("Favourites")
.listRowPlatterColor(Color.gray)
.frame(height:50)
}
HStack {
Image(systemName: "gear")
Text("Settings")
.listRowPlatterColor(Color.gray)
.frame(height:50)
}
}
.listStyle(.carousel)
}Thanks.
Post not yet marked as solved
Hi, I am building an app that has about 8,000 rows of data (file size is around 1MB). At the moment I am storing this all in a plist, but I read that I should keep plists below 200Kb. I also need to read and write this data, so it would be handy to use database functionality rather than serialising 8,000 rows for each operation.So does SQLite exist on the Apple Watch? How can I create an SQLite database-based app in Xcode? Thanks.