Pure Swift Cross-platform UIKit (Cocoa Touch) implementation (Supports Linux)

Overview

Cacao

Swift Platforms Release License SPM compatible

Pure Swift Cross-platform UIKit (Cocoa Touch) implementation (Supports Linux)

Build

OS X

brew install cairo sdl2 lcms2
swift build -Xlinker -L/usr/local/lib

Ubuntu

sudo apt-get install libcairo-dev libsdl2-dev liblcms2-dev
swift build

Screenshots

Run PaintCode StyleKits in Linux

Image

Hardware-accelered UIView animations

Image Image

Layout views according to a UIViewContentMode

Image

Create applications that run in the native Window Manager

Image

Image

Comments
  • Build error

    Build error

    I'm trying to run your demo application but the build failed because of the error below.

    Compile Swift Module 'Silica' (19 sources)
    /home/bmdelacruz/Documents/Projects/swift/Cacao/.build/checkouts/Silica.git-4667709516086632535/Sources/Silica/CGRect.swift:32:56: error: ambiguous use of 'nan'
        public static var null: CGRect { return CGRect(x: .nan, y: .nan, width: .nan, height: .nan) }
                                                           ^
    Foundation.CGFloat:14:23: note: found this candidate
        public static var nan: Foundation.CGFloat { get }
                          ^
    Swift.Double:137:23: note: found this candidate
        public static var nan: Double { get }
    

    OS: Ubuntu 16.04 Swift version: Swift version 4.0-dev (LLVM 2dedb62a0b, Clang b9d76a314c, Swift 61ad3c07ef)

    bug 
    opened by bmdelacruz 6
  • The performance might not be as well as UIKit in iOS devices theoretically.

    The performance might not be as well as UIKit in iOS devices theoretically.

    I found that Cacao is using Cairo for 2D rendering.It's said that Cairo's performance is worse than Skia (which is based on OpenGL and Vulkan). And Metal2.0 is even much faster than Vulkan.

    Take Flutter For example, it performs not so well in iOS. The render engine should be taken into consideration.

    opened by lilidan 2
  • Build failed

    Build failed

    I cant build this project because dependencies

    
    >swift build
    Cloning https://github.com/PureSwift/Silica.git
    git clone --recursive --depth 10 https://github.com/PureSwift/Silica.git /home/admin1/Downloads/Cacao-master/Packages/Silica.git
    
    fatal error: unexpectedly found nil while unwrapping an Optional value
    Current stack trace:
    0    libswiftCore.so                    0x00007f22f5201fc0 swift_reportError + 117
    1    libswiftCore.so                    0x00007f22f5214df0 _swift_stdlib_reportFatalError + 63
    2    libswiftCore.so                    0x00007f22f50226a3 <unavailable> + 0
    3    libswiftCore.so                    0x00007f22f517fdfd <unavailable> + 0
    4    libswiftCore.so                    0x00007f22f50226a3 <unavailable> + 0
    5    libswiftCore.so                    0x00007f22f51416b0 specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never + 96
    6    swift-build                        0x00000000005a9ad5 <unavailable> + 0
    7    swift-build                        0x0000000000652707 <unavailable> + 0
    8    swift-build                        0x000000000065e08d <unavailable> + 0
    9    swift-build                        0x000000000065fd92 <unavailable> + 0
    10   swift-build                        0x0000000000654f41 <unavailable> + 0
    11   swift-build                        0x0000000000656ebe <unavailable> + 0
    12   swift-build                        0x00000000006565dd <unavailable> + 0
    13   swift-build                        0x0000000000656f8c <unavailable> + 0
    14   libswiftCore.so                    0x00007f22f50c3ea0 Sequence.flatMap<A where ...> ((A.Iterator.Element) throws -> A1) throws -> [A1.Iterator.Element] + 576
    15   swift-build                        0x00000000006531dc <unavailable> + 0
    16   swift-build                        0x0000000000652bb4 <unavailable> + 0
    17   swift-build                        0x000000000065b232 <unavailable> + 0
    18   swift-build                        0x0000000000703f0b <unavailable> + 0
    19   swift-build                        0x00000000006f9615 <unavailable> + 0
    20   swift-build                        0x00000000004156b8 <unavailable> + 0
    21   libc.so.6                          0x00007f22f31d9740 __libc_start_main + 240
    22   swift-build                        0x0000000000415579 <unavailable> + 0
    Illegal instruction (core dumped)
    
    
    opened by vBoykoGit 2
  • Display Carthage support in Readme

    Display Carthage support in Readme

    Hi, If your component is compatible with Carthage It would be nice if you added on your README.md Carthage compatible on top and a section for the installation with Carthage.

    enhancement 
    opened by TofPlay 2
  • Implement Text Rendering

    Implement Text Rendering

    • The goal of this feature is to implement NSString.drawWithRect(). Fonts have been added to Silica, and the main rendering code should be done there, NSString.drawWithRect() is for UIKit compatibility.
    • Work on this feature is being done on the Text branch in Cacao and the master branch in Silica.
    • A PaintCode StyleKit test canvas and unit test case has been added to test this functionality. This feature will be considered done when that unit test renders the same output as PaintCode / UIKit.
    feature 
    opened by colemancda 1
  • UIView SDL texture not always rendering to screen in Linux

    UIView SDL texture not always rendering to screen in Linux

    The temporary workaround for this is to convert the Cairo surface to PNG data, and then discard that data. Its hard to debug this because in the rendering unit tests, the SDL texture raw data is as expected, and the code works fine on macOS, so the source of the problem is currently unknown.

    bug help wanted 
    opened by colemancda 0
  • UIView invalid layout on Linux

    UIView invalid layout on Linux

    For some reason the layout is invalid on Linux, but fine on macOS. The previous Cairo-backed version did not have this issue, so the issue probably lies in our use of SDL.

    bug 
    opened by colemancda 0
  • Implement UIView Animations

    Implement UIView Animations

    Animate changes to one or more views using the specified duration. class func animate(withDuration duration: TimeInterval, animations: @escaping () -> ()) Documentation

    feature 
    opened by colemancda 0
  • SDL Texture support

    SDL Texture support

    UIViews should be backed by SDL.Texture akin to CALayer in iOS. This will allow 3D acceleration, OpenGL support, embedded SDL use (SDL inception dawg) and even video streaming.

    enhancement feature 
    opened by colemancda 0
  • Add a Gitter chat badge to README.md

    Add a Gitter chat badge to README.md

    PureSwift/Cacao now has a Chat Room on Gitter

    @colemancda has just created a chat room. You can visit it here: https://gitter.im/PureSwift/Cacao.

    This pull-request adds this badge to your README.md:

    Gitter

    If my aim is a little off, please let me know.

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    opened by gitter-badger 0
  • Build error with CacaoDemo on macOS Mojave

    Build error with CacaoDemo on macOS Mojave

    Hi. Maybe it's a configuration error from myself but : I launched the CacaoDemo .xcodeproj in Xcode and tried to run it. Building is OK but while running, I can see this error (even for iOS or tvOS version) :

    Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)

    Also, here is the return for updating package :

    Hackintosh:Cacao-develop anard$ swift package update
    Updating https://github.com/PureSwift/SDL.git
    Updating https://github.com/PureSwift/Cairo.git
    Updating https://github.com/PureSwift/Silica.git
    https://github.com/PureSwift/Silica.git @ master: error: manifest parse error(s):
    /var/folders/t_/hcs46zld3wz4qn55xkhldg4h0000gn/T/TemporaryFile.a3iNIj.swift:11:5: error: argument 'dependencies' must precede argument 'targets'
        dependencies: [
    ~~~~^~~~~~~~~~~~~~~
    Hackintosh:Cacao-develop anard$
    

    Thanks for your work

    opened by Anard 0
  • UIApplication delegate marked as weak instead of unknown(unsafe)

    UIApplication delegate marked as weak instead of unknown(unsafe)

    As mentioned above, delegate should be unknown(unsafe) instead of weak

    Reference: https://developer.apple.com/documentation/uikit/uiapplication/1622936-delegate

    Project looks great!

    Might base an AppKit implementation off of what you've got going on here. Looks solid.

    opened by tmclea03 0
  • Failing to build on Ubuntu 18.04, swift version 4.2.1

    Failing to build on Ubuntu 18.04, swift version 4.2.1

    Good evening,

    Firstly, I'm thrilled to have come across a community of developers building frameworks for developing swift-based software across platforms.

    Unfortunately I'm having trouble getting this to build. I've gotten apt to install the prerequisite packages as per command:

    sudo apt-get install libcairo-dev libsdl2-dev liblcms2-dev

    My setup: Dev machine: Ubuntu 18.04

    Swift version:

    $ swift --version
    Swift version 4.2.1 (swift-4.2.1-RELEASE)
    Target: x86_64-unknown-linux-gnu
    

    Anything I might be missing? Below is the raw build output:

    Build Output:

    /home/me/workspace/Cacao$ swift build
    Fetching https://github.com/PureSwift/Cairo.git
    Fetching https://github.com/PureSwift/CFreeType.git
    Fetching https://github.com/PureSwift/CCairo.git
    Fetching https://github.com/PureSwift/CFontConfig.git
    Fetching https://github.com/PureSwift/SDL.git
    Fetching https://github.com/PureSwift/Silica.git
    Fetching https://github.com/PureSwift/CSDL2.git
    Completed resolution in 16.69s
    Cloning https://github.com/PureSwift/Silica.git
    Resolving https://github.com/PureSwift/Silica.git at master
    Cloning https://github.com/PureSwift/SDL.git
    Resolving https://github.com/PureSwift/SDL.git at master
    Cloning https://github.com/PureSwift/CSDL2.git
    Resolving https://github.com/PureSwift/CSDL2.git at master
    Cloning https://github.com/PureSwift/CFreeType.git
    Resolving https://github.com/PureSwift/CFreeType.git at 1.0.4
    Cloning https://github.com/PureSwift/Cairo.git
    Resolving https://github.com/PureSwift/Cairo.git at master
    Cloning https://github.com/PureSwift/CFontConfig.git
    Resolving https://github.com/PureSwift/CFontConfig.git at 1.0.1
    Cloning https://github.com/PureSwift/CCairo.git
    Resolving https://github.com/PureSwift/CCairo.git at 1.1.1
    warning: PackageDescription API v3 is deprecated and will be removed in the future; used by package(s): CSDL2, Silica, Cairo, CFreeType, CFontConfig, CCairo
    Compile Swift Module 'SDL' (14 sources)
    Compile Swift Module 'Cairo' (14 sources)
    swift: /home/buildnode/jenkins/workspace/oss-swift-4.2-package-linux-ubuntu-18_04/llvm/tools/clang/lib/Serialization/ASTWriter.cpp:5508: clang::serialization::DeclID clang::ASTWriter::getDeclID(const clang::Decl *): Assertion `DeclIDs.find(D) != DeclIDs.end() && "Declaration not emitted!"' failed.
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3defe74]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3dedc8c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3df0032]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f60b23ce890]
    /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f60b0831e97]
    /lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7f60b0833801]
    /lib/x86_64-linux-gnu/libc.so.6(+0x3039a)[0x7f60b082339a]
    /lib/x86_64-linux-gnu/libc.so.6(+0x30412)[0x7f60b0823412]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32b370a]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32aeb9c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32bfff9]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32bce9b]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x33024de]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f7c06c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x30dcbb6]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f54580]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2efff11]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f0ac20]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3d8bdeb]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3d8bf34]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3df11aa]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x76db)[0x7f60b23c36db]
    /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f60b091488f]
    Stack dump:
    0.	<eof> parser at end of file
    <unknown>:0: error: unable to execute command: Aborted
    <unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
    swift: /home/buildnode/jenkins/workspace/oss-swift-4.2-package-linux-ubuntu-18_04/llvm/tools/clang/lib/Serialization/ASTWriter.cpp:5508: clang::serialization::DeclID clang::ASTWriter::getDeclID(const clang::Decl *): Assertion `DeclIDs.find(D) != DeclIDs.end() && "Declaration not emitted!"' failed.
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3defe74]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3dedc8c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3df0032]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f26a9ad9890]
    /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f26a7f3ce97]
    /lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7f26a7f3e801]
    /lib/x86_64-linux-gnu/libc.so.6(+0x3039a)[0x7f26a7f2e39a]
    /lib/x86_64-linux-gnu/libc.so.6(+0x30412)[0x7f26a7f2e412]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32b370a]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32aeb9c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32bfff9]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32bce9b]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x33024de]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f7c06c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x30dcbb6]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f54580]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2efff11]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f0ac20]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3d8bdeb]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3d8bf34]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3df11aa]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x76db)[0x7f26a9ace6db]
    /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f26a801f88f]
    Stack dump:
    0.	<eof> parser at end of file
    <unknown>:0: error: unable to execute command: Aborted
    <unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
    swift: /home/buildnode/jenkins/workspace/oss-swift-4.2-package-linux-ubuntu-18_04/llvm/tools/clang/lib/Serialization/ASTWriter.cpp:5508: clang::serialization::DeclID clang::ASTWriter::getDeclID(const clang::Decl *): Assertion `DeclIDs.find(D) != DeclIDs.end() && "Declaration not emitted!"' failed.
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3defe74]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3dedc8c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3df0032]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f26985d9890]
    /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f2696a3ce97]
    /lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7f2696a3e801]
    /lib/x86_64-linux-gnu/libc.so.6(+0x3039a)[0x7f2696a2e39a]
    /lib/x86_64-linux-gnu/libc.so.6(+0x30412)[0x7f2696a2e412]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32b370a]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32aeb9c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32bfff9]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32bce9b]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x33024de]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f7c06c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x30dcbb6]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f54580]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2efff11]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f0ac20]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3d8bdeb]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3d8bf34]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3df11aa]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x76db)[0x7f26985ce6db]
    /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f2696b1f88f]
    Stack dump:
    0.	<eof> parser at end of file
    <unknown>:0: error: unable to execute command: Aborted
    <unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
    swift: /home/buildnode/jenkins/workspace/oss-swift-4.2-package-linux-ubuntu-18_04/llvm/tools/clang/lib/Serialization/ASTWriter.cpp:5508: clang::serialization::DeclID clang::ASTWriter::getDeclID(const clang::Decl *): Assertion `DeclIDs.find(D) != DeclIDs.end() && "Declaration not emitted!"' failed.
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3defe74]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3dedc8c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3df0032]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7fe71f5e3890]
    /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7fe71da46e97]
    /lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7fe71da48801]
    /lib/x86_64-linux-gnu/libc.so.6(+0x3039a)[0x7fe71da3839a]
    /lib/x86_64-linux-gnu/libc.so.6(+0x30412)[0x7fe71da38412]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32b370a]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32aeb9c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32bfff9]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x32bce9b]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x33024de]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f7c06c]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x30dcbb6]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f54580]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2efff11]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x2f0ac20]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3d8bdeb]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3d8bf34]
    /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift[0x3df11aa]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x76db)[0x7fe71f5d86db]
    /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7fe71db2988f]
    Stack dump:
    0.	<eof> parser at end of file
    <unknown>:0: error: unable to execute command: Aborted
    <unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
    error: terminated(1): /my/path/bin/swift/swift-4.2.1-RELEASE-ubuntu18.04/usr/bin/swift-build-tool -f /media/truecrypt1/development/swift/Cacao/.build/debug.yaml main output:
    
    
    
    opened by kevinvandenbreemen 1
  • Fails to build on macOS

    Fails to build on macOS

    When I try to build 9cda4a1 using swift build -Xlinker -L/usr/local/lib I get:

    Cacao/Sources/Cacao/UIView.swift:734:47: error: type 'SDLPixelFormat.Format' has no member 'argb8888'
                                         format: .argb8888, // SDL_PIXELFORMAT_ARGB8888
                                                  ^~~~~~~~
    
    opened by Dev1an 1
  • Build fails on Ubuntu 16.04 using Swift 4.1

    Build fails on Ubuntu 16.04 using Swift 4.1

    Related to #35, but has some additional build errors.

    I'm compiling this on Ubuntu 16.04 LTS and there are several other errors when compiling the Cacao module, aside from the UndoManager. I'm using Swift 4.1.

    In several locations, properties are defined in both Foundation and Silica.

    Output from swift build.

    Cacao/Sources/Cacao/TextRendering.swift:50:44: error: ambiguous use of 'width'
            case .center: textRect.origin.x = (bounds.width - textRect.width) / 2
                                               ^
    Foundation.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get set }
                   ^
    Cacao/Sources/Cacao/TextRendering.swift:52:42: error: ambiguous use of 'width'
            case .right: textRect.origin.x = bounds.width - textRect.width
                                             ^
    Foundation.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get set }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:38:61: error: ambiguous use of 'minX'
            let thumbPath = UIBezierPath(roundedRect: CGRect(x: frame.minX + 0.5, y: frame.minY + 0.5, width: frame.width - 1, height: frame.height - 1), cornerRadius: 14)
                                                                ^
    Foundation.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:44:73: error: ambiguous use of 'minX'
            let thumbShadowStrokePath = UIBezierPath(roundedRect: CGRect(x: frame.minX + 0.5, y: frame.minY + 0.5, width: frame.width - 1, height: frame.height - 1), cornerRadius: 14)
                                                                            ^
    Foundation.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:57:32: error: ambiguous use of 'minX'
            context.translateBy(x: resizedFrame.minX, y: resizedFrame.minY)
                                   ^
    Foundation.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:58:28: error: ambiguous use of 'width'
            context.scaleBy(x: resizedFrame.width / 51, y: resizedFrame.height / 31)
                               ^
    Foundation.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get set }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:70:32: error: ambiguous use of 'minX'
            context.translateBy(x: backgroundViewRect.minX, y: backgroundViewRect.minY)
                                   ^
    Foundation.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:80:32: error: ambiguous use of 'minX'
            context.translateBy(x: thumbRect.minX, y: thumbRect.minY)
                                   ^
    Foundation.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:82:75: error: ambiguous use of 'width'
            UISwitchStyleKit.drawSwitchThumb(frame: CGRect(x: 0, y: 0, width: thumbRect.width, height: thumbRect.height), thumbColor: thumbColor)
                                                                              ^
    Foundation.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get set }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:96:32: error: ambiguous use of 'minX'
            context.translateBy(x: resizedFrame.minX, y: resizedFrame.minY)
                                   ^
    Foundation.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:97:28: error: ambiguous use of 'width'
            context.scaleBy(x: resizedFrame.width / 51, y: resizedFrame.height / 31)
                               ^
    Foundation.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get set }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:133:32: error: ambiguous use of 'width'
                scales.width = abs(target.width / rect.width)
                                   ^
    Foundation.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get set }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:134:33: error: ambiguous use of 'height'
                scales.height = abs(target.height / rect.height)
                                    ^
    Foundation.CGRect:5:16: note: found this candidate
        public var height: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:5:16: note: found this candidate
        public var height: Foundation.CGFloat { get set }
                   ^
    Cacao/Sources/Cacao/StyleKit/UISwitchStyleKit.swift:150:26: error: ambiguous use of 'standardized'
                var result = rect.standardized
                             ^
    Foundation.CGRect:17:16: note: found this candidate
        public var standardized: Foundation.CGRect { get }
                   ^
    Silica.CGRect:12:16: note: found this candidate
        public var standardized: Foundation.CGRect { get }
                   ^
    Cacao/Sources/Cacao/SDL.swift:82:17: warning: result of call to 'run(mode:before:)' is unused
            runloop.run(mode: .defaultRunLoopMode, before: Date() + (1.0 / TimeInterval(framesPerSecond)))
                    ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Cacao/Sources/Cacao/UIBezierPath.swift:85:35: error: ambiguous use of 'maxX'
            let topRight = CGPoint(x: rect.maxX, y: rect.minY)
                                      ^
    Foundation.CGRect:8:16: note: found this candidate
        public var maxX: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:8:16: note: found this candidate
        public var maxX: Foundation.CGFloat { get }
                   ^
    Cacao/Sources/Cacao/UIBezierPath.swift:86:38: error: ambiguous use of 'maxX'
            let bottomRight = CGPoint(x: rect.maxX, y: rect.maxY)
                                         ^
    Foundation.CGRect:8:16: note: found this candidate
        public var maxX: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:8:16: note: found this candidate
        public var maxX: Foundation.CGFloat { get }
                   ^
    Cacao/Sources/Cacao/UIBezierPath.swift:87:37: error: ambiguous use of 'minX'
            let bottomLeft = CGPoint(x: rect.minX, y: rect.maxY)
                                        ^
    Foundation.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Cacao/Sources/Cacao/UIScrollView.swift:141:24: error: ambiguous use of 'intersection'
            var goalRect = rect.intersection(contentRect)
                           ^
    Foundation.CGRect:21:17: note: found this candidate
        public func intersection(_ r2: Foundation.CGRect) -> Foundation.CGRect
                    ^
    Silica.CGRect:20:17: note: found this candidate
        public func intersection(_ other: Foundation.CGRect) -> Foundation.CGRect
                    ^
    Cacao/Sources/Cacao/UITableView.swift:337:28: error: ambiguous use of 'intersects'
                .filter { self.bounds.intersects(self.rectForRow(at: $0)) } // get visible cells
                               ^
    Foundation.CGRect:22:17: note: found this candidate
        public func intersects(_ r2: Foundation.CGRect) -> Bool
                    ^
    Silica.CGRect:19:17: note: found this candidate
        public func intersects(_ r2: Foundation.CGRect) -> Bool
                    ^
    Cacao/Sources/Cacao/UITableView.swift:299:24: error: ambiguous use of 'intersects'
                        if rect.intersects(simpleRowRect) {
                           ^
    Foundation.CGRect:22:17: note: found this candidate
        public func intersects(_ r2: Foundation.CGRect) -> Bool
                    ^
    Silica.CGRect:19:17: note: found this candidate
        public func intersects(_ r2: Foundation.CGRect) -> Bool
                    ^
    Cacao/Sources/Cacao/UITableView.swift:873:32: error: ambiguous use of 'height'
                tableViewHeight += sectionRect.height
                                   ^
    Foundation.CGRect:5:16: note: found this candidate
        public var height: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:5:16: note: found this candidate
        public var height: Foundation.CGFloat { get set }
                   ^
    Cacao/Sources/Cacao/UITableView.swift:876:19: error: ambiguous use of 'intersects'
                guard sectionRect.intersects(visibleBounds)
                      ^
    Foundation.CGRect:22:17: note: found this candidate
        public func intersects(_ r2: Foundation.CGRect) -> Bool
                    ^
    Silica.CGRect:19:17: note: found this candidate
        public func intersects(_ r2: Foundation.CGRect) -> Bool
                    ^
    Cacao/Sources/Cacao/UITableView.swift:893:23: error: ambiguous use of 'intersects'
                    guard rowRect.intersects(visibleBounds),
                          ^
    Foundation.CGRect:22:17: note: found this candidate
        public func intersects(_ r2: Foundation.CGRect) -> Bool
                    ^
    Silica.CGRect:19:17: note: found this candidate
        public func intersects(_ r2: Foundation.CGRect) -> Bool
                    ^
    Cacao/Sources/Cacao/UITableView.swift:954:12: error: ambiguous use of 'isNull'
            if rect.isNull == false, rect.size.height > 0 {
               ^
    Foundation.CGRect:14:16: note: found this candidate
        public var isNull: Bool { get }
                   ^
    Silica.CGRect:15:16: note: found this candidate
        public var isNull: Bool { get }
                   ^
    Cacao/Sources/Cacao/UIView.swift:907:28: error: ambiguous use of 'minX'
            return (point.x >= rect.minX && point.x <= rect.maxX)
                               ^
    Foundation.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:6:16: note: found this candidate
        public var minX: Foundation.CGFloat { get }
                   ^
    Cacao/Sources/Cacao/UIViewContentMode.swift:53:30: error: ambiguous use of 'width'
                let widthRatio = bounds.width / size.width
                                 ^
    Foundation.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:4:16: note: found this candidate
        public var width: Foundation.CGFloat { get set }
                   ^
    Cacao/Sources/Cacao/UIViewContentMode.swift:54:31: error: ambiguous use of 'height'
                let heightRatio = bounds.height / size.height
                                  ^
    Foundation.CGRect:5:16: note: found this candidate
        public var height: Foundation.CGFloat { get }
                   ^
    Silica.CGRect:5:16: note: found this candidate
        public var height: Foundation.CGFloat { get set }
    
    opened by Arc676 0
Releases(0.7.0)
Owner
Open Source #PureSwift frameworks
null
A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI.

A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI. Many of these helpers are useful even in a pure UIKit project.

SwiftUI+ 6 Oct 28, 2022
Lightweight touch visualization library in Swift. A single line of code and visualize your touches!

TouchVisualizer is a lightweight pure Swift implementation for visualising touches on the screen. Features Works with just a single line of code! Supp

Morita Naoki 851 Dec 17, 2022
SAHistoryNavigationViewController realizes iOS task manager like UI in UINavigationContoller. Support 3D Touch!

SAHistoryNavigationViewController Support 3D Touch for iOS9!! SAHistoryNavigationViewController realizes iOS task manager like UI in UINavigationConto

Taiki Suzuki 1.6k Dec 29, 2022
Custom segue for OSX Storyboards with slide and cross fade effects (NSViewControllerTransitionOptions)

CustomSegue Custom segue for OSX Storyboards. Slide and cross fade effects, new customized window. class MyViewController: NSViewController { overr

Eric Marchand 123 May 21, 2022
UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images.

MultiSelectSegmentedControl UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images. Feature

Yonat Sharon 286 Dec 15, 2022
ScrollView that supports a parallax header image and static overlay.

ScrollViewReactiveHeader A replacement ScrollView that provides a header with subtle scroll animations. example-video.mov Using ScrollViewReactiveHead

null 49 Dec 29, 2022
A minimalistic looking banner library for iOS. It supports multiple customizable kinds of Banner types

A minimalistic looking banner library for iOS. It supports multiple customizable kinds of Banner types

Emre Armagan 12 Oct 10, 2022
A Powerful , Extensible CSS Parser written in pure Swift.

A Powerful , Extensible CSS Parser written in pure Swift. Basic Usage From CSS: #View { "width" : 118; "height" : 120.5; "color1" : "#888888"; "co

null 273 Sep 9, 2022
MUDownloadButton - a Progressive Download button written in pure swift and inspired by AppStore download button

MUDownloadButton is a Progressive Download button written in pure swift and inspired by AppStore download button . feel free to contribute and pull requests

Mohammad ShahibZadeh 2 Feb 20, 2022
A multi-platform SwiftUI component for tabular data

SwiftTabler A multi-platform SwiftUI component for tabular data. NOTE this component is BRAND NEW and under active development. If you need stability,

OpenAlloc 45 Jan 3, 2023
🚀 Elegant Pager View fully written in pure SwiftUI.

PagerTabStripView Made with ❤️ by Xmartlabs team. XLPagerTabStrip for SwiftUI! Introduction PagerTabStripView is the first pager view built in pure Sw

xmartlabs 482 Jan 9, 2023
Swift extensions for UIKit.framework.

XUIKit Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation XUIKit is a

FITZ 0 Oct 22, 2021
🎨 View instance initializing sugar for Swift & UIKit

?? View instance initializing sugar for Swift & UIKit

Yongjun Lee 11 Dec 1, 2022
Swift programming language hackathon. Implementation of the main logic of working with an ATM in the Playground environment.

Hackaton-ATM-PJ04 Swift programming language hackathon. Implementation of the main logic of working with an ATM in the Playground environment. The tas

Raman Kozar 2 Oct 4, 2022
Neumorphism framework for UIKit.

NeumorphismKit is neumorphism framework for UIKit. Requirements iOS 12.0+ Swift 5.1+ Versions NeumorphismKit version Xcode version 1.0.0 Xcode 11+ 1.1

y-okudera 42 Dec 13, 2022
Easily use UIKit views in your SwiftUI applications. Create Xcode Previews for UIView elements

SwiftUIKitView Easily use UIKit views in SwiftUI. Convert UIView to SwiftUI View Create Xcode Previews from UIView elements SwiftUI functional updatin

Antoine van der Lee 682 Dec 29, 2022
Make ComposableArchitecture work with UIKit

ComposableUIKit The ComposableArchitecture (TCA) library provides a way of structuring Swift code with the Redux-pattern. It is highly optimized for S

Manuel Maly 11 Nov 5, 2022
Combine publisher bridges for UIKit

Combine publisher bridges for UIKit

Combine Community 1.3k Jan 1, 2023
Convenient domain specific language for writing programmatic UI built over UIKit and more.

XYKit Swifty and convenient domain specific language for creating programmatic UI in a more declarative way and more than that. Built on top of UIKit

Denis Goloborodko 1 Nov 5, 2021