Latest 1.0.6
Homepage https://github.com/LeeKahSeng/KSFacebookButton
License MIT
Platforms ios 8.0, requires ARC
Authors

Carthage compatible
CocoaPods
Platform
GitHub license

KSFacebookButton is a simple custom button which look exactly the same as FBSDKLoginButton. The problem with FBSDKLoginButton is that it do not allow any customization on the look and feel of the button. With KSFacebookButton you can change the title, width and height or even corner radius of the button easily.

Requirements

  • Xcode 9 or later
  • iOS 8.0 or later
  • Swift 4.0 or later

Features

  • Support XCode storybord

Example

Clone / download and open KSFacebookButtonExample.xcworkspace to see KSFacebookButton in action.
Here are few examples:



Installation

CocoaPods

pod 'KSFacebookButton'

Carthage

github "LeeKahSeng/KSFacebookButton"
  1. After finish building the framework using Carthage, open XCode and select you project in the project navigator.
  2. At Build Phases tab, add KSFacebookButton.framework to Link Binary with Libraries.
  3. At General tab, add KSFacebookButton.framework to Embedded Binaries.

Note: If using Carthage for installation, IBDesignable and IBInspectable will not work due to a bug in XCode. Details information can be found here.

Manually

  1. Download the project.
  2. Drag the Sources folder in KSFacebookButtonKSFacebookButton into your XCode project.
  3. Build & run.

How to use

Storyboard

  1. Drag a UIButton to your view controller.
  2. Open Indentity Inspector and change button class to KSFacebookButton.
  3. Open Indentity Inspector and change button module to KSFacebookButton. (This step only required when install using CocoaPods or Carthage)
  4. Open Attribute Inspector and select "Custom" as button type.
  5. Change the button size, corner radius and title base on your needs using storyboard.
  6. Build & run.

Code

Make sure you import KSFacebookButton if you are using CocoaPods or Carthage.

import KSFacebookButton

KSFacebookButton can be initialize and configure just like normal UIButton.

let facebookButton = KSFacebookButton(frame: CGRect(x: 20, y: 20, width: 200, height: 55))
facebookButton.cornerRadius = 3.0
facebookButton.setTitle("Login with Facebook", for: .normal)
facebookButton.addTarget(self, action: #selector(facebookButtonDidTapped(sender:)), for: .touchUpInside)
view.addSubview(facebookButton)

License

This code is distributed under the terms and conditions of the MIT license.

Latest podspec

{
    "name": "KSFacebookButton",
    "version": "1.0.6",
    "summary": "A customizable button which looks exactly the same as FBSDKLoginButton",
    "description": "KSFacebookButton is a simple custom button which looks exactly the same as FBSDKLoginButton. The problem with FBSDKLoginButton is that it do not allow any customization on the look and feel of the button. With KSFacebookButton you can change the title, width and height or even corner radius of the button easily.",
    "homepage": "https://github.com/LeeKahSeng/KSFacebookButton",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Lee Kah Seng": "[email protected]"
    },
    "source": {
        "git": "https://github.com/LeeKahSeng/KSFacebookButton.git",
        "tag": "1.0.6",
        "branch": "master"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "KSFacebookButton/KSFacebookButton/Sources/*.swift",
    "resources": "KSFacebookButton/KSFacebookButton/Sources/Images/*",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This