Skip to content

1. Toy example applications

Jaehun You edited this page Mar 16, 2023 · 2 revisions

Several toy example applications are provided to demonstrate the basic features of swift.

For convenience, you can download example databases: database.zip

1. Random number generator

GUI - generator frame

  • A combobox for selecting a database into which the generated number is saved
  • A button for generating a new number

GUI - viewer frame

  • A label for showing the current status (database updated, random number generated, etc.)
  • A label for showing the recently generated number

Backend

  • generate() -> int: Generate a random number and return it
  • write() -> bool: Save the given number into the database

2. Logger

GUI

  • A read-only text field that prints out the log messages

Backend

Not required.

3. Poller

GUI

  • A combobox for selecting a database into which the polled number is saved
  • A spinbox for adjusting the polling period
  • A label for showing the polled count (how many numbers have been polled): this will confidently show when the polling occurs
  • A label for showing the recently polled number

Backend

  • poll() -> int: Return a predictable number e.g. time.time() % 100
  • write() -> bool: Save the given number into the database

4. Database manager

GUI

  • A list whose each row shows the database name, path, and a button to remove the row from the list
  • A button to add a row (new database)

Backend

Not required.

5. Data calculator

GUI

  • A combobox for selecting the database from which the value of 'A' is fetched
  • A combobox for selecting the database from which the value of 'B' is fetched
  • A label showing the sum of recently fetched 'A' and 'B'
  • A button for calculating the sum

Backend

  • read() -> int: Read the given database and return the fetched number