【SwiftUI】Action Sheet を作ってみる

↓こちらのサイトを参考にして、Action Sheet を作ってみた。

medium.com

ActionSheet のタイトル部分も、動的に変わるようにしてみたけど、最初の1回だけ値が入らない。バグ?

import SwiftUI

struct ContentView : View {
    
    @State private var selectID:String = ""
    @State private var isActionSheetVisible = false
    var actionSheet: ActionSheet? {
        let button1 = ActionSheet.Button.default(Text("Facebook")) {
            self.isActionSheetVisible = false
            print("Facebook = " + self.selectID)
        }
        let button2 = ActionSheet.Button.default(Text("Instagram")) {
            self.isActionSheetVisible = false
            print("Instagram = " + self.selectID)
        }
        let button3 = ActionSheet.Button.default(Text("Twitter")) {
            self.isActionSheetVisible = false
            print("Twitter = " + self.selectID)
        }
        let dismissButton = ActionSheet.Button.cancel {
            self.isActionSheetVisible = false
        }
        let buttons = [button1, button2, button3, dismissButton]
        
        return self.isActionSheetVisible ? ActionSheet(title: Text("Share " + self.selectID),buttons: buttons) : nil
        
    }
    private var uuids: [String] = {
        let ids: [String] = Array(0...5).map { _ in
            return UUID().uuidString
        }
        return ids
    }()
    
    var body: some View {
        NavigationView {
            List(uuids.identified(by: \.self)) { uuid in
                Button(action: {
                    self.isActionSheetVisible = true
                    self.selectID = uuid
                }) {
                    Text(uuid)
                }
                .presentation(self.actionSheet)
                
            }.navigationBarTitle(Text("List of UUIDs"))
        }
    }
}