KeyChain.Constructor(index as Integer)
From Xojo Documentation
| This method is only available on the macOS platform.
For cross-platform development, use ＃If...＃Endif with the Target... specifiers to make sure you will not attempt to use this method on an incompatible platform.
Gives you a reference to any KeyChain known by the KeyChain manager. The Index value should be in the range from 0 to System.KeyChainCount.
This constructor is in a For loop that instantiates a KeyChain for each for each KeyChain item. It populates a ListBox with the list of keychains. It is in the Open event of the app.
Declare Function KCGetKeychainName Lib "Carbon" (keychain As Integer, keychainName As Ptr) As Integer
Dim i As Integer
Dim err As Integer
Dim kc As KeyChain
Dim kcName As MemoryBlock
kcName = New MemoryBlock(256)
For i = 0 To System.KeyChainCount - 1
kc = New KeyChain(i)
If kc = Nil Then
MsgBox("Keychain(" + Str(i) + ") returned nil")
err = KCGetKeychainName(kc.Handle, kcName)
If err <> 0 Then
MsgBox("KCGetKeychainName returned " + Str(err))