Problem solved. The issue was happening because I was using a wrong path for the library.
I was trying to call the library from:
/lib/swift_required.php
And it should be located somewhere like here:
$basePath = '/home/mydomain/domains/mydomain.org/public_html/myapp/';
require_once($basePath . 'system/vendor/swift/Swift/lib/swift_required.php');