B4i Library iSwiftyButton

Discussion in 'iOS Libraries' started by Erel, Jan 24, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Don't use this library. Better option: https://www.b4x.com/android/forum/threads/b4x-xui-swiftbutton.95180/

    This is a wrapper for https://github.com/TakeScoop/SwiftyButton.


    The PressableButton should be added as a custom view with the designer.

    The open source project is a Swift project. This is the first library that wraps a Swift project.
    The wrapper code is available here: https://github.com/AnywhereSoftware/B4i_iSwiftyButton

    You should also copy the framework to the Mac Libs folder if you are using a local builder.
    Note that there is no simulator binary included in the framework.
    The minimum version for Swift libraries is iOS 8:
    #MinVersion: 8
    Edit: v1.01 is released. Fixes a small issue.

    The framework is available here:
    Xcode 9: www.b4x.com/b4i/files/SwiftyButton.framework.zip
    Xcode 10: www.b4x.com/b4i/files/Xcode10SwiftFrameworks.zip
    You should download it directly to your Mac.

    Attached Files:

    Last edited: Sep 20, 2018
    JordiCP, ShaneG30, alwaysbusy and 4 others like this.
  2. so27

    so27 Active Member Licensed User

    Very beautiful! Is this also soon for B4A?
  3. tufanv

    tufanv Expert Licensed User

    Thanks Erel. These may seem little visual things but they are very good for our projects !. If you will have time in the future , we wait for these little but powerfull things in the future.
    JanPRO likes this.
  4. Erel

    Erel Administrator Staff Member Licensed User

    This is based on an iOS project.
  5. miker2069

    miker2069 Active Member Licensed User

    If I understand correctly, iOS stock buttons are pretty blah, and there's alot of work to customize them - this would make it about as easy as it can be even when compared to developing with swift itself. I still haven't tinkered with swift yet.

    Maybe this is off topic but will be B4i eventually support custom swift libraries? I really am not up to speed on where Apple is with Objective C and Swift, are they pushing devs to Swift or are they happily co-existing?
  6. Erel

    Erel Administrator Staff Member Licensed User

    With this update you can integrate swift libraries. The wrapper itself is written in Objective C but the wrapper code by its nature is simple.
  7. miker2069

    miker2069 Active Member Licensed User

    So this is very cool - so we can either choose to include Obj-C or Swift Libs in a project.
  8. Erel

    Erel Administrator Staff Member Licensed User

    You can create an Objective C wrapper that references a Swift framework.
    You can also reference the Swift framework directly and use NativeObject or inline OBJC to access it.

    For example this code creates a FlatButton. iSwiftyButton library (the wrapper) is not used.
    #AdditionalLib: SwiftyButton.framework.swift.3
    #MinVersion: 8
    Sub Process_Globals
    'These global variables will be declared once when the application starts.
       'Public variables can be accessed from all modules.
       Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page

    End Sub

    Private Sub Application_Start (Nav As NavigationController)
       NavControl = Nav
       Page1.Title = 
    "Page 1"
       Page1.RootPanel.Color = 
    Dim b As Button = CreateFlatButton(Colors.Red)
       b.Text = 
    End Sub

    Sub CreateFlatButton (clr As Int) As Button
    Dim no As NativeObject
       no = no.Initialize(
       no = no.RunMethod(
    "color", no.ColorToUIColor(clr))
    Return no
    End Sub
  9. daniel69

    daniel69 Member Licensed User

    Very interesting!
  10. tufanv

    tufanv Expert Licensed User

    I will try to implement another example just referencing the swift framework. First I wanted to try this code but where is the framework file ? (
    #AdditionalLib: SwiftyButton.framework.swift.3)
  11. Erel

    Erel Administrator Staff Member Licensed User

    Were you able to submit your app to the app store with the swift library?

    The framework is already available on the hosted builders. You do not need it locally.
  12. tufanv

    tufanv Expert Licensed User

    Not yet, I will change back to swiftybutton again.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice