├── .gitignore ├── .swift-version ├── KSFacebookButton.podspec ├── KSFacebookButton ├── KSFacebookButton.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── KSFacebookButton.xcscheme └── KSFacebookButton │ ├── Info.plist │ ├── KSFacebookButton.h │ └── Sources │ ├── Images │ ├── icon-facebook.png │ ├── icon-facebook@2x.png │ └── icon-facebook@3x.png │ └── KSFacebookButton.swift ├── KSFacebookButtonExample.xcworkspace └── contents.xcworkspacedata ├── KSFacebookButtonExample ├── KSFacebookButtonExample.xcodeproj │ └── project.pbxproj └── KSFacebookButtonExample │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── LICENSE ├── README-Assets ├── example1.png ├── example2.png └── example3.png └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | .build/ 41 | 42 | # CocoaPods 43 | # 44 | # We recommend against adding the Pods directory to your .gitignore. However 45 | # you should judge for yourself, the pros and cons are mentioned at: 46 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 47 | # 48 | # Pods/ 49 | 50 | # Carthage 51 | # 52 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 53 | # Carthage/Checkouts 54 | 55 | Carthage/Build 56 | 57 | # fastlane 58 | # 59 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 60 | # screenshots whenever they are needed. 61 | # For more information about the recommended setup visit: 62 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 63 | 64 | fastlane/report.xml 65 | fastlane/Preview.html 66 | fastlane/screenshots 67 | fastlane/test_output 68 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.2 2 | -------------------------------------------------------------------------------- /KSFacebookButton.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'KSFacebookButton' 3 | s.version = '1.0.9' 4 | s.summary = 'A customizable button which looks exactly the same as FBSDKLoginButton ' 5 | 6 | s.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.' 7 | 8 | s.homepage = 'https://github.com/LeeKahSeng/KSFacebookButton' 9 | s.license = { :type => 'MIT', :file => 'LICENSE' } 10 | s.author = { 'Lee Kah Seng' => 'kahseng.lee123@gmail.com' } 11 | s.source = { 12 | :git => 'https://github.com/LeeKahSeng/KSFacebookButton.git', 13 | :tag => s.version.to_s, 14 | :branch => 'master' 15 | } 16 | 17 | s.swift_version = '4.2' 18 | s.requires_arc = true 19 | s.ios.deployment_target = '8.0' 20 | s.source_files = 'KSFacebookButton/KSFacebookButton/Sources/*.swift' 21 | s.resources = 'KSFacebookButton/KSFacebookButton/Sources/Images/*' 22 | 23 | end 24 | -------------------------------------------------------------------------------- /KSFacebookButton/KSFacebookButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F9F6CE201ED1639C00EBEDD0 /* KSFacebookButton.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F6CE1E1ED1639C00EBEDD0 /* KSFacebookButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | F9F6CE2C1ED1640700EBEDD0 /* icon-facebook.png in Resources */ = {isa = PBXBuildFile; fileRef = F9F6CE281ED1640700EBEDD0 /* icon-facebook.png */; }; 12 | F9F6CE2D1ED1640700EBEDD0 /* icon-facebook@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F9F6CE291ED1640700EBEDD0 /* icon-facebook@2x.png */; }; 13 | F9F6CE2E1ED1640700EBEDD0 /* icon-facebook@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = F9F6CE2A1ED1640700EBEDD0 /* icon-facebook@3x.png */; }; 14 | F9F6CE2F1ED1640700EBEDD0 /* KSFacebookButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9F6CE2B1ED1640700EBEDD0 /* KSFacebookButton.swift */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | F9F6CE1B1ED1639C00EBEDD0 /* KSFacebookButton.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KSFacebookButton.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | F9F6CE1E1ED1639C00EBEDD0 /* KSFacebookButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KSFacebookButton.h; sourceTree = ""; }; 20 | F9F6CE1F1ED1639C00EBEDD0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 21 | F9F6CE281ED1640700EBEDD0 /* icon-facebook.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-facebook.png"; sourceTree = ""; }; 22 | F9F6CE291ED1640700EBEDD0 /* icon-facebook@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-facebook@2x.png"; sourceTree = ""; }; 23 | F9F6CE2A1ED1640700EBEDD0 /* icon-facebook@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-facebook@3x.png"; sourceTree = ""; }; 24 | F9F6CE2B1ED1640700EBEDD0 /* KSFacebookButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KSFacebookButton.swift; sourceTree = ""; }; 25 | /* End PBXFileReference section */ 26 | 27 | /* Begin PBXFrameworksBuildPhase section */ 28 | F9F6CE171ED1639C00EBEDD0 /* Frameworks */ = { 29 | isa = PBXFrameworksBuildPhase; 30 | buildActionMask = 2147483647; 31 | files = ( 32 | ); 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXFrameworksBuildPhase section */ 36 | 37 | /* Begin PBXGroup section */ 38 | F9F6CE111ED1639B00EBEDD0 = { 39 | isa = PBXGroup; 40 | children = ( 41 | F9F6CE1D1ED1639C00EBEDD0 /* KSFacebookButton */, 42 | F9F6CE1C1ED1639C00EBEDD0 /* Products */, 43 | ); 44 | sourceTree = ""; 45 | }; 46 | F9F6CE1C1ED1639C00EBEDD0 /* Products */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | F9F6CE1B1ED1639C00EBEDD0 /* KSFacebookButton.framework */, 50 | ); 51 | name = Products; 52 | sourceTree = ""; 53 | }; 54 | F9F6CE1D1ED1639C00EBEDD0 /* KSFacebookButton */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | F9F6CE261ED1640700EBEDD0 /* Sources */, 58 | F9F6CE1E1ED1639C00EBEDD0 /* KSFacebookButton.h */, 59 | F9F6CE1F1ED1639C00EBEDD0 /* Info.plist */, 60 | ); 61 | path = KSFacebookButton; 62 | sourceTree = ""; 63 | }; 64 | F9F6CE261ED1640700EBEDD0 /* Sources */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | F9F6CE271ED1640700EBEDD0 /* Images */, 68 | F9F6CE2B1ED1640700EBEDD0 /* KSFacebookButton.swift */, 69 | ); 70 | path = Sources; 71 | sourceTree = ""; 72 | }; 73 | F9F6CE271ED1640700EBEDD0 /* Images */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | F9F6CE281ED1640700EBEDD0 /* icon-facebook.png */, 77 | F9F6CE291ED1640700EBEDD0 /* icon-facebook@2x.png */, 78 | F9F6CE2A1ED1640700EBEDD0 /* icon-facebook@3x.png */, 79 | ); 80 | path = Images; 81 | sourceTree = ""; 82 | }; 83 | /* End PBXGroup section */ 84 | 85 | /* Begin PBXHeadersBuildPhase section */ 86 | F9F6CE181ED1639C00EBEDD0 /* Headers */ = { 87 | isa = PBXHeadersBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | F9F6CE201ED1639C00EBEDD0 /* KSFacebookButton.h in Headers */, 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | /* End PBXHeadersBuildPhase section */ 95 | 96 | /* Begin PBXNativeTarget section */ 97 | F9F6CE1A1ED1639C00EBEDD0 /* KSFacebookButton */ = { 98 | isa = PBXNativeTarget; 99 | buildConfigurationList = F9F6CE231ED1639C00EBEDD0 /* Build configuration list for PBXNativeTarget "KSFacebookButton" */; 100 | buildPhases = ( 101 | F9F6CE161ED1639C00EBEDD0 /* Sources */, 102 | F9F6CE171ED1639C00EBEDD0 /* Frameworks */, 103 | F9F6CE181ED1639C00EBEDD0 /* Headers */, 104 | F9F6CE191ED1639C00EBEDD0 /* Resources */, 105 | ); 106 | buildRules = ( 107 | ); 108 | dependencies = ( 109 | ); 110 | name = KSFacebookButton; 111 | productName = KSFacebookButton; 112 | productReference = F9F6CE1B1ED1639C00EBEDD0 /* KSFacebookButton.framework */; 113 | productType = "com.apple.product-type.framework"; 114 | }; 115 | /* End PBXNativeTarget section */ 116 | 117 | /* Begin PBXProject section */ 118 | F9F6CE121ED1639B00EBEDD0 /* Project object */ = { 119 | isa = PBXProject; 120 | attributes = { 121 | LastUpgradeCheck = 1010; 122 | ORGANIZATIONNAME = "Lee Kah Seng"; 123 | TargetAttributes = { 124 | F9F6CE1A1ED1639C00EBEDD0 = { 125 | CreatedOnToolsVersion = 8.3.2; 126 | DevelopmentTeam = SM42V25455; 127 | LastSwiftMigration = 0900; 128 | ProvisioningStyle = Automatic; 129 | }; 130 | }; 131 | }; 132 | buildConfigurationList = F9F6CE151ED1639B00EBEDD0 /* Build configuration list for PBXProject "KSFacebookButton" */; 133 | compatibilityVersion = "Xcode 3.2"; 134 | developmentRegion = English; 135 | hasScannedForEncodings = 0; 136 | knownRegions = ( 137 | en, 138 | ); 139 | mainGroup = F9F6CE111ED1639B00EBEDD0; 140 | productRefGroup = F9F6CE1C1ED1639C00EBEDD0 /* Products */; 141 | projectDirPath = ""; 142 | projectRoot = ""; 143 | targets = ( 144 | F9F6CE1A1ED1639C00EBEDD0 /* KSFacebookButton */, 145 | ); 146 | }; 147 | /* End PBXProject section */ 148 | 149 | /* Begin PBXResourcesBuildPhase section */ 150 | F9F6CE191ED1639C00EBEDD0 /* Resources */ = { 151 | isa = PBXResourcesBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | F9F6CE2E1ED1640700EBEDD0 /* icon-facebook@3x.png in Resources */, 155 | F9F6CE2C1ED1640700EBEDD0 /* icon-facebook.png in Resources */, 156 | F9F6CE2D1ED1640700EBEDD0 /* icon-facebook@2x.png in Resources */, 157 | ); 158 | runOnlyForDeploymentPostprocessing = 0; 159 | }; 160 | /* End PBXResourcesBuildPhase section */ 161 | 162 | /* Begin PBXSourcesBuildPhase section */ 163 | F9F6CE161ED1639C00EBEDD0 /* Sources */ = { 164 | isa = PBXSourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | F9F6CE2F1ED1640700EBEDD0 /* KSFacebookButton.swift in Sources */, 168 | ); 169 | runOnlyForDeploymentPostprocessing = 0; 170 | }; 171 | /* End PBXSourcesBuildPhase section */ 172 | 173 | /* Begin XCBuildConfiguration section */ 174 | F9F6CE211ED1639C00EBEDD0 /* Debug */ = { 175 | isa = XCBuildConfiguration; 176 | buildSettings = { 177 | ALWAYS_SEARCH_USER_PATHS = NO; 178 | CLANG_ANALYZER_NONNULL = YES; 179 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 180 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 181 | CLANG_CXX_LIBRARY = "libc++"; 182 | CLANG_ENABLE_MODULES = YES; 183 | CLANG_ENABLE_OBJC_ARC = YES; 184 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 185 | CLANG_WARN_BOOL_CONVERSION = YES; 186 | CLANG_WARN_COMMA = YES; 187 | CLANG_WARN_CONSTANT_CONVERSION = YES; 188 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 190 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 191 | CLANG_WARN_EMPTY_BODY = YES; 192 | CLANG_WARN_ENUM_CONVERSION = YES; 193 | CLANG_WARN_INFINITE_RECURSION = YES; 194 | CLANG_WARN_INT_CONVERSION = YES; 195 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 196 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 197 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 199 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 200 | CLANG_WARN_STRICT_PROTOTYPES = YES; 201 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 202 | CLANG_WARN_UNREACHABLE_CODE = YES; 203 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 204 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 205 | COPY_PHASE_STRIP = NO; 206 | CURRENT_PROJECT_VERSION = 1; 207 | DEBUG_INFORMATION_FORMAT = dwarf; 208 | ENABLE_STRICT_OBJC_MSGSEND = YES; 209 | ENABLE_TESTABILITY = YES; 210 | GCC_C_LANGUAGE_STANDARD = gnu99; 211 | GCC_DYNAMIC_NO_PIC = NO; 212 | GCC_NO_COMMON_BLOCKS = YES; 213 | GCC_OPTIMIZATION_LEVEL = 0; 214 | GCC_PREPROCESSOR_DEFINITIONS = ( 215 | "DEBUG=1", 216 | "$(inherited)", 217 | ); 218 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 219 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 220 | GCC_WARN_UNDECLARED_SELECTOR = YES; 221 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 222 | GCC_WARN_UNUSED_FUNCTION = YES; 223 | GCC_WARN_UNUSED_VARIABLE = YES; 224 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 225 | MTL_ENABLE_DEBUG_INFO = YES; 226 | ONLY_ACTIVE_ARCH = YES; 227 | SDKROOT = iphoneos; 228 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 229 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 230 | TARGETED_DEVICE_FAMILY = "1,2"; 231 | VERSIONING_SYSTEM = "apple-generic"; 232 | VERSION_INFO_PREFIX = ""; 233 | }; 234 | name = Debug; 235 | }; 236 | F9F6CE221ED1639C00EBEDD0 /* Release */ = { 237 | isa = XCBuildConfiguration; 238 | buildSettings = { 239 | ALWAYS_SEARCH_USER_PATHS = NO; 240 | CLANG_ANALYZER_NONNULL = YES; 241 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 242 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 243 | CLANG_CXX_LIBRARY = "libc++"; 244 | CLANG_ENABLE_MODULES = YES; 245 | CLANG_ENABLE_OBJC_ARC = YES; 246 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 247 | CLANG_WARN_BOOL_CONVERSION = YES; 248 | CLANG_WARN_COMMA = YES; 249 | CLANG_WARN_CONSTANT_CONVERSION = YES; 250 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 251 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 252 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 253 | CLANG_WARN_EMPTY_BODY = YES; 254 | CLANG_WARN_ENUM_CONVERSION = YES; 255 | CLANG_WARN_INFINITE_RECURSION = YES; 256 | CLANG_WARN_INT_CONVERSION = YES; 257 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 259 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 260 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 261 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 262 | CLANG_WARN_STRICT_PROTOTYPES = YES; 263 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 264 | CLANG_WARN_UNREACHABLE_CODE = YES; 265 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 266 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 267 | COPY_PHASE_STRIP = NO; 268 | CURRENT_PROJECT_VERSION = 1; 269 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 270 | ENABLE_NS_ASSERTIONS = NO; 271 | ENABLE_STRICT_OBJC_MSGSEND = YES; 272 | GCC_C_LANGUAGE_STANDARD = gnu99; 273 | GCC_NO_COMMON_BLOCKS = YES; 274 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 275 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 276 | GCC_WARN_UNDECLARED_SELECTOR = YES; 277 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 278 | GCC_WARN_UNUSED_FUNCTION = YES; 279 | GCC_WARN_UNUSED_VARIABLE = YES; 280 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 281 | MTL_ENABLE_DEBUG_INFO = NO; 282 | SDKROOT = iphoneos; 283 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 284 | TARGETED_DEVICE_FAMILY = "1,2"; 285 | VALIDATE_PRODUCT = YES; 286 | VERSIONING_SYSTEM = "apple-generic"; 287 | VERSION_INFO_PREFIX = ""; 288 | }; 289 | name = Release; 290 | }; 291 | F9F6CE241ED1639C00EBEDD0 /* Debug */ = { 292 | isa = XCBuildConfiguration; 293 | buildSettings = { 294 | CODE_SIGN_IDENTITY = ""; 295 | DEFINES_MODULE = YES; 296 | DEVELOPMENT_TEAM = SM42V25455; 297 | DYLIB_COMPATIBILITY_VERSION = 1; 298 | DYLIB_CURRENT_VERSION = 1; 299 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 300 | INFOPLIST_FILE = KSFacebookButton/Info.plist; 301 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 302 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 303 | PRODUCT_BUNDLE_IDENTIFIER = com.LeeKahSeng.KSFacebookButton; 304 | PRODUCT_NAME = "$(TARGET_NAME)"; 305 | SKIP_INSTALL = YES; 306 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 307 | SWIFT_VERSION = 4.2; 308 | }; 309 | name = Debug; 310 | }; 311 | F9F6CE251ED1639C00EBEDD0 /* Release */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | CODE_SIGN_IDENTITY = ""; 315 | DEFINES_MODULE = YES; 316 | DEVELOPMENT_TEAM = SM42V25455; 317 | DYLIB_COMPATIBILITY_VERSION = 1; 318 | DYLIB_CURRENT_VERSION = 1; 319 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 320 | INFOPLIST_FILE = KSFacebookButton/Info.plist; 321 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 322 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 323 | PRODUCT_BUNDLE_IDENTIFIER = com.LeeKahSeng.KSFacebookButton; 324 | PRODUCT_NAME = "$(TARGET_NAME)"; 325 | SKIP_INSTALL = YES; 326 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 327 | SWIFT_VERSION = 4.2; 328 | }; 329 | name = Release; 330 | }; 331 | /* End XCBuildConfiguration section */ 332 | 333 | /* Begin XCConfigurationList section */ 334 | F9F6CE151ED1639B00EBEDD0 /* Build configuration list for PBXProject "KSFacebookButton" */ = { 335 | isa = XCConfigurationList; 336 | buildConfigurations = ( 337 | F9F6CE211ED1639C00EBEDD0 /* Debug */, 338 | F9F6CE221ED1639C00EBEDD0 /* Release */, 339 | ); 340 | defaultConfigurationIsVisible = 0; 341 | defaultConfigurationName = Release; 342 | }; 343 | F9F6CE231ED1639C00EBEDD0 /* Build configuration list for PBXNativeTarget "KSFacebookButton" */ = { 344 | isa = XCConfigurationList; 345 | buildConfigurations = ( 346 | F9F6CE241ED1639C00EBEDD0 /* Debug */, 347 | F9F6CE251ED1639C00EBEDD0 /* Release */, 348 | ); 349 | defaultConfigurationIsVisible = 0; 350 | defaultConfigurationName = Release; 351 | }; 352 | /* End XCConfigurationList section */ 353 | }; 354 | rootObject = F9F6CE121ED1639B00EBEDD0 /* Project object */; 355 | } 356 | -------------------------------------------------------------------------------- /KSFacebookButton/KSFacebookButton.xcodeproj/xcshareddata/xcschemes/KSFacebookButton.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /KSFacebookButton/KSFacebookButton/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.9 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /KSFacebookButton/KSFacebookButton/KSFacebookButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSFacebookButton.h 3 | // KSFacebookButton 4 | // 5 | // Created by Lee Kah Seng on 21/05/2017. 6 | // Copyright © 2017 Lee Kah Seng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for KSFacebookButton. 12 | FOUNDATION_EXPORT double KSFacebookButtonVersionNumber; 13 | 14 | //! Project version string for KSFacebookButton. 15 | FOUNDATION_EXPORT const unsigned char KSFacebookButtonVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /KSFacebookButton/KSFacebookButton/Sources/Images/icon-facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeeKahSeng/KSFacebookButton/038dc1f1b9c67e6f2354a556086ab63c8c2b2448/KSFacebookButton/KSFacebookButton/Sources/Images/icon-facebook.png -------------------------------------------------------------------------------- /KSFacebookButton/KSFacebookButton/Sources/Images/icon-facebook@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeeKahSeng/KSFacebookButton/038dc1f1b9c67e6f2354a556086ab63c8c2b2448/KSFacebookButton/KSFacebookButton/Sources/Images/icon-facebook@2x.png -------------------------------------------------------------------------------- /KSFacebookButton/KSFacebookButton/Sources/Images/icon-facebook@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeeKahSeng/KSFacebookButton/038dc1f1b9c67e6f2354a556086ab63c8c2b2448/KSFacebookButton/KSFacebookButton/Sources/Images/icon-facebook@3x.png -------------------------------------------------------------------------------- /KSFacebookButton/KSFacebookButton/Sources/KSFacebookButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KSFacebookButton.swift 3 | // KSFacebookButtonExample 4 | // 5 | // Created by Lee Kah Seng on 17/05/2017. 6 | // Copyright (c) 2017 KSFacebookButton (https://github.com/LeeKahSeng/KSFacebookButton) 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | // SOFTWARE. 25 | // 26 | 27 | import UIKit 28 | 29 | @IBDesignable 30 | public class KSFacebookButton: UIButton { 31 | 32 | let buttonNormalBackgroundColor = UIColor(red: 59.0/255.0, green: 89.0/255.0, blue: 152.0/255.0, alpha: 1.0) 33 | let buttonHighlightBackgroundColor = UIColor(red: 31.0/255.0, green: 44.0/255.0, blue: 82.0/255.0, alpha: 1.0) 34 | 35 | @IBInspectable 36 | public var cornerRadius: CGFloat = 5.0 { 37 | didSet { 38 | self.layer.cornerRadius = cornerRadius 39 | } 40 | } 41 | 42 | override public init(frame: CGRect) { 43 | super.init(frame: frame) 44 | commonSetup() 45 | } 46 | 47 | required public init?(coder aDecoder: NSCoder) { 48 | super.init(coder: aDecoder) 49 | commonSetup() 50 | } 51 | 52 | override public func draw(_ rect: CGRect) { 53 | super.draw(rect) 54 | 55 | // Set button corner radius 56 | layer.cornerRadius = cornerRadius 57 | clipsToBounds = true 58 | 59 | // Set Facebook icon 60 | let bundle = Bundle(for: KSFacebookButton.self) 61 | let icon = UIImage(named: "icon-facebook", in: bundle, compatibleWith: nil) 62 | setImage(icon, for: .normal) 63 | } 64 | 65 | override public var isHighlighted: Bool { 66 | willSet { 67 | backgroundColor = newValue ? buttonHighlightBackgroundColor : buttonNormalBackgroundColor 68 | } 69 | } 70 | 71 | // MARK: - Private 72 | private func commonSetup() { 73 | backgroundColor = buttonNormalBackgroundColor 74 | setTitleColor(.white, for: .normal) 75 | setTitleColor(.white, for: .highlighted) 76 | if #available(iOS 8.2, *) { 77 | titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: UIFont.Weight.medium) 78 | } else { 79 | // Fallback on earlier versions 80 | titleLabel?.font = UIFont.systemFont(ofSize: 13) 81 | } 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /KSFacebookButtonExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /KSFacebookButtonExample/KSFacebookButtonExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F9498F401F357B69003E3DE8 /* KSFacebookButton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F9498F3F1F357B69003E3DE8 /* KSFacebookButton.framework */; }; 11 | F9AF67151ECC33370014044B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9AF67141ECC33370014044B /* AppDelegate.swift */; }; 12 | F9AF67171ECC33370014044B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9AF67161ECC33370014044B /* ViewController.swift */; }; 13 | F9AF671A1ECC33370014044B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F9AF67181ECC33370014044B /* Main.storyboard */; }; 14 | F9AF671C1ECC33380014044B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F9AF671B1ECC33370014044B /* Assets.xcassets */; }; 15 | F9AF671F1ECC33380014044B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F9AF671D1ECC33380014044B /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | F9498F3D1F357A14003E3DE8 /* KSFacebookButton.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = KSFacebookButton.framework; path = "../KSFacebookButton/build/Debug-iphoneos/KSFacebookButton.framework"; sourceTree = ""; }; 20 | F9498F3F1F357B69003E3DE8 /* KSFacebookButton.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = KSFacebookButton.framework; path = "../KSFacebookButton/build/Debug-iphoneos/KSFacebookButton.framework"; sourceTree = ""; }; 21 | F9AF67111ECC33370014044B /* KSFacebookButtonExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KSFacebookButtonExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | F9AF67141ECC33370014044B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | F9AF67161ECC33370014044B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | F9AF67191ECC33370014044B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | F9AF671B1ECC33370014044B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | F9AF671E1ECC33380014044B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | F9AF67201ECC33380014044B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | /* End PBXFileReference section */ 29 | 30 | /* Begin PBXFrameworksBuildPhase section */ 31 | F9AF670E1ECC33370014044B /* Frameworks */ = { 32 | isa = PBXFrameworksBuildPhase; 33 | buildActionMask = 2147483647; 34 | files = ( 35 | F9498F401F357B69003E3DE8 /* KSFacebookButton.framework in Frameworks */, 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | F9498F3C1F357A14003E3DE8 /* Frameworks */ = { 43 | isa = PBXGroup; 44 | children = ( 45 | F9498F3F1F357B69003E3DE8 /* KSFacebookButton.framework */, 46 | F9498F3D1F357A14003E3DE8 /* KSFacebookButton.framework */, 47 | ); 48 | name = Frameworks; 49 | sourceTree = ""; 50 | }; 51 | F9AF67081ECC33370014044B = { 52 | isa = PBXGroup; 53 | children = ( 54 | F9AF67131ECC33370014044B /* KSFacebookButtonExample */, 55 | F9AF67121ECC33370014044B /* Products */, 56 | F9498F3C1F357A14003E3DE8 /* Frameworks */, 57 | ); 58 | sourceTree = ""; 59 | }; 60 | F9AF67121ECC33370014044B /* Products */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | F9AF67111ECC33370014044B /* KSFacebookButtonExample.app */, 64 | ); 65 | name = Products; 66 | sourceTree = ""; 67 | }; 68 | F9AF67131ECC33370014044B /* KSFacebookButtonExample */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | F9AF67141ECC33370014044B /* AppDelegate.swift */, 72 | F9AF67161ECC33370014044B /* ViewController.swift */, 73 | F9AF67181ECC33370014044B /* Main.storyboard */, 74 | F9AF671B1ECC33370014044B /* Assets.xcassets */, 75 | F9AF671D1ECC33380014044B /* LaunchScreen.storyboard */, 76 | F9AF67201ECC33380014044B /* Info.plist */, 77 | ); 78 | path = KSFacebookButtonExample; 79 | sourceTree = ""; 80 | }; 81 | /* End PBXGroup section */ 82 | 83 | /* Begin PBXNativeTarget section */ 84 | F9AF67101ECC33370014044B /* KSFacebookButtonExample */ = { 85 | isa = PBXNativeTarget; 86 | buildConfigurationList = F9AF67231ECC33380014044B /* Build configuration list for PBXNativeTarget "KSFacebookButtonExample" */; 87 | buildPhases = ( 88 | F9AF670D1ECC33370014044B /* Sources */, 89 | F9AF670E1ECC33370014044B /* Frameworks */, 90 | F9AF670F1ECC33370014044B /* Resources */, 91 | ); 92 | buildRules = ( 93 | ); 94 | dependencies = ( 95 | ); 96 | name = KSFacebookButtonExample; 97 | productName = KSFacebookButtonExample; 98 | productReference = F9AF67111ECC33370014044B /* KSFacebookButtonExample.app */; 99 | productType = "com.apple.product-type.application"; 100 | }; 101 | /* End PBXNativeTarget section */ 102 | 103 | /* Begin PBXProject section */ 104 | F9AF67091ECC33370014044B /* Project object */ = { 105 | isa = PBXProject; 106 | attributes = { 107 | LastSwiftUpdateCheck = 0830; 108 | LastUpgradeCheck = 1010; 109 | ORGANIZATIONNAME = "Lee Kah Seng"; 110 | TargetAttributes = { 111 | F9AF67101ECC33370014044B = { 112 | CreatedOnToolsVersion = 8.3.2; 113 | DevelopmentTeam = SM42V25455; 114 | LastSwiftMigration = 0900; 115 | ProvisioningStyle = Automatic; 116 | }; 117 | }; 118 | }; 119 | buildConfigurationList = F9AF670C1ECC33370014044B /* Build configuration list for PBXProject "KSFacebookButtonExample" */; 120 | compatibilityVersion = "Xcode 3.2"; 121 | developmentRegion = English; 122 | hasScannedForEncodings = 0; 123 | knownRegions = ( 124 | en, 125 | Base, 126 | ); 127 | mainGroup = F9AF67081ECC33370014044B; 128 | productRefGroup = F9AF67121ECC33370014044B /* Products */; 129 | projectDirPath = ""; 130 | projectRoot = ""; 131 | targets = ( 132 | F9AF67101ECC33370014044B /* KSFacebookButtonExample */, 133 | ); 134 | }; 135 | /* End PBXProject section */ 136 | 137 | /* Begin PBXResourcesBuildPhase section */ 138 | F9AF670F1ECC33370014044B /* Resources */ = { 139 | isa = PBXResourcesBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | F9AF671F1ECC33380014044B /* LaunchScreen.storyboard in Resources */, 143 | F9AF671C1ECC33380014044B /* Assets.xcassets in Resources */, 144 | F9AF671A1ECC33370014044B /* Main.storyboard in Resources */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXResourcesBuildPhase section */ 149 | 150 | /* Begin PBXSourcesBuildPhase section */ 151 | F9AF670D1ECC33370014044B /* Sources */ = { 152 | isa = PBXSourcesBuildPhase; 153 | buildActionMask = 2147483647; 154 | files = ( 155 | F9AF67171ECC33370014044B /* ViewController.swift in Sources */, 156 | F9AF67151ECC33370014044B /* AppDelegate.swift in Sources */, 157 | ); 158 | runOnlyForDeploymentPostprocessing = 0; 159 | }; 160 | /* End PBXSourcesBuildPhase section */ 161 | 162 | /* Begin PBXVariantGroup section */ 163 | F9AF67181ECC33370014044B /* Main.storyboard */ = { 164 | isa = PBXVariantGroup; 165 | children = ( 166 | F9AF67191ECC33370014044B /* Base */, 167 | ); 168 | name = Main.storyboard; 169 | sourceTree = ""; 170 | }; 171 | F9AF671D1ECC33380014044B /* LaunchScreen.storyboard */ = { 172 | isa = PBXVariantGroup; 173 | children = ( 174 | F9AF671E1ECC33380014044B /* Base */, 175 | ); 176 | name = LaunchScreen.storyboard; 177 | sourceTree = ""; 178 | }; 179 | /* End PBXVariantGroup section */ 180 | 181 | /* Begin XCBuildConfiguration section */ 182 | F9AF67211ECC33380014044B /* Debug */ = { 183 | isa = XCBuildConfiguration; 184 | buildSettings = { 185 | ALWAYS_SEARCH_USER_PATHS = NO; 186 | CLANG_ANALYZER_NONNULL = YES; 187 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 188 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 189 | CLANG_CXX_LIBRARY = "libc++"; 190 | CLANG_ENABLE_MODULES = YES; 191 | CLANG_ENABLE_OBJC_ARC = YES; 192 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 193 | CLANG_WARN_BOOL_CONVERSION = YES; 194 | CLANG_WARN_COMMA = YES; 195 | CLANG_WARN_CONSTANT_CONVERSION = YES; 196 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 197 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 198 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 199 | CLANG_WARN_EMPTY_BODY = YES; 200 | CLANG_WARN_ENUM_CONVERSION = YES; 201 | CLANG_WARN_INFINITE_RECURSION = YES; 202 | CLANG_WARN_INT_CONVERSION = YES; 203 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 204 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 205 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 206 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 207 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 208 | CLANG_WARN_STRICT_PROTOTYPES = YES; 209 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 210 | CLANG_WARN_UNREACHABLE_CODE = YES; 211 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 212 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 213 | COPY_PHASE_STRIP = NO; 214 | DEBUG_INFORMATION_FORMAT = dwarf; 215 | ENABLE_STRICT_OBJC_MSGSEND = YES; 216 | ENABLE_TESTABILITY = YES; 217 | GCC_C_LANGUAGE_STANDARD = gnu99; 218 | GCC_DYNAMIC_NO_PIC = NO; 219 | GCC_NO_COMMON_BLOCKS = YES; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_PREPROCESSOR_DEFINITIONS = ( 222 | "DEBUG=1", 223 | "$(inherited)", 224 | ); 225 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 227 | GCC_WARN_UNDECLARED_SELECTOR = YES; 228 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 229 | GCC_WARN_UNUSED_FUNCTION = YES; 230 | GCC_WARN_UNUSED_VARIABLE = YES; 231 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 232 | MTL_ENABLE_DEBUG_INFO = YES; 233 | ONLY_ACTIVE_ARCH = YES; 234 | SDKROOT = iphoneos; 235 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 236 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 237 | }; 238 | name = Debug; 239 | }; 240 | F9AF67221ECC33380014044B /* Release */ = { 241 | isa = XCBuildConfiguration; 242 | buildSettings = { 243 | ALWAYS_SEARCH_USER_PATHS = NO; 244 | CLANG_ANALYZER_NONNULL = YES; 245 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 246 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 247 | CLANG_CXX_LIBRARY = "libc++"; 248 | CLANG_ENABLE_MODULES = YES; 249 | CLANG_ENABLE_OBJC_ARC = YES; 250 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 251 | CLANG_WARN_BOOL_CONVERSION = YES; 252 | CLANG_WARN_COMMA = YES; 253 | CLANG_WARN_CONSTANT_CONVERSION = YES; 254 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 255 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 256 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 257 | CLANG_WARN_EMPTY_BODY = YES; 258 | CLANG_WARN_ENUM_CONVERSION = YES; 259 | CLANG_WARN_INFINITE_RECURSION = YES; 260 | CLANG_WARN_INT_CONVERSION = YES; 261 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 262 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 263 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 264 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 265 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 266 | CLANG_WARN_STRICT_PROTOTYPES = YES; 267 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 271 | COPY_PHASE_STRIP = NO; 272 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 273 | ENABLE_NS_ASSERTIONS = NO; 274 | ENABLE_STRICT_OBJC_MSGSEND = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu99; 276 | GCC_NO_COMMON_BLOCKS = YES; 277 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 278 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 279 | GCC_WARN_UNDECLARED_SELECTOR = YES; 280 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 281 | GCC_WARN_UNUSED_FUNCTION = YES; 282 | GCC_WARN_UNUSED_VARIABLE = YES; 283 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 284 | MTL_ENABLE_DEBUG_INFO = NO; 285 | SDKROOT = iphoneos; 286 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 287 | VALIDATE_PRODUCT = YES; 288 | }; 289 | name = Release; 290 | }; 291 | F9AF67241ECC33380014044B /* Debug */ = { 292 | isa = XCBuildConfiguration; 293 | buildSettings = { 294 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 295 | DEVELOPMENT_TEAM = SM42V25455; 296 | INFOPLIST_FILE = KSFacebookButtonExample/Info.plist; 297 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 298 | PRODUCT_BUNDLE_IDENTIFIER = com.LeeKahSeng.KSFacebookButtonExample; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 301 | SWIFT_VERSION = 4.2; 302 | }; 303 | name = Debug; 304 | }; 305 | F9AF67251ECC33380014044B /* Release */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 309 | DEVELOPMENT_TEAM = SM42V25455; 310 | INFOPLIST_FILE = KSFacebookButtonExample/Info.plist; 311 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 312 | PRODUCT_BUNDLE_IDENTIFIER = com.LeeKahSeng.KSFacebookButtonExample; 313 | PRODUCT_NAME = "$(TARGET_NAME)"; 314 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 315 | SWIFT_VERSION = 4.2; 316 | }; 317 | name = Release; 318 | }; 319 | /* End XCBuildConfiguration section */ 320 | 321 | /* Begin XCConfigurationList section */ 322 | F9AF670C1ECC33370014044B /* Build configuration list for PBXProject "KSFacebookButtonExample" */ = { 323 | isa = XCConfigurationList; 324 | buildConfigurations = ( 325 | F9AF67211ECC33380014044B /* Debug */, 326 | F9AF67221ECC33380014044B /* Release */, 327 | ); 328 | defaultConfigurationIsVisible = 0; 329 | defaultConfigurationName = Release; 330 | }; 331 | F9AF67231ECC33380014044B /* Build configuration list for PBXNativeTarget "KSFacebookButtonExample" */ = { 332 | isa = XCConfigurationList; 333 | buildConfigurations = ( 334 | F9AF67241ECC33380014044B /* Debug */, 335 | F9AF67251ECC33380014044B /* Release */, 336 | ); 337 | defaultConfigurationIsVisible = 0; 338 | defaultConfigurationName = Release; 339 | }; 340 | /* End XCConfigurationList section */ 341 | }; 342 | rootObject = F9AF67091ECC33370014044B /* Project object */; 343 | } 344 | -------------------------------------------------------------------------------- /KSFacebookButtonExample/KSFacebookButtonExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // KSFacebookButtonExample 4 | // 5 | // Created by Lee Kah Seng on 17/05/2017. 6 | // Copyright © 2017 Lee Kah Seng. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /KSFacebookButtonExample/KSFacebookButtonExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /KSFacebookButtonExample/KSFacebookButtonExample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /KSFacebookButtonExample/KSFacebookButtonExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 32 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /KSFacebookButtonExample/KSFacebookButtonExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /KSFacebookButtonExample/KSFacebookButtonExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // KSFacebookButtonExample 4 | // 5 | // Created by Lee Kah Seng on 17/05/2017. 6 | // Copyright © 2017 Lee Kah Seng. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import KSFacebookButton 11 | 12 | class ViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | // Create custom Facebook button at center of the screen 18 | let facebookButton = KSFacebookButton(frame: CGRect(x: 0, y: 0, width: 140, height: 55)) 19 | facebookButton.center = view.center 20 | facebookButton.setTitle("Tap me!", for: .normal) 21 | facebookButton.addTarget(self, action: #selector(facebookButtonDidTapped(sender:)), for: .touchUpInside) 22 | view.addSubview(facebookButton) 23 | } 24 | 25 | override func didReceiveMemoryWarning() { 26 | super.didReceiveMemoryWarning() 27 | // Dispose of any resources that can be recreated. 28 | } 29 | 30 | 31 | @objc func facebookButtonDidTapped(sender: KSFacebookButton) { 32 | print("Facebook button tapped!") 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 LeeKahSeng 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README-Assets/example1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeeKahSeng/KSFacebookButton/038dc1f1b9c67e6f2354a556086ab63c8c2b2448/README-Assets/example1.png -------------------------------------------------------------------------------- /README-Assets/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeeKahSeng/KSFacebookButton/038dc1f1b9c67e6f2354a556086ab63c8c2b2448/README-Assets/example2.png -------------------------------------------------------------------------------- /README-Assets/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeeKahSeng/KSFacebookButton/038dc1f1b9c67e6f2354a556086ab63c8c2b2448/README-Assets/example3.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KSFacebookButton 2 | 3 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 4 | [![CocoaPods](https://img.shields.io/cocoapods/v/KSFacebookButton.svg)](http://cocoapods.org/pods/KSFacebookButton) 5 | [![Platform](https://img.shields.io/cocoapods/p/KSFacebookButton.svg?)](http://cocoadocs.org/docsets/KSFacebookButton) 6 | [![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/Carthage/Carthage/master/LICENSE.md) 7 | 8 | **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. 9 | 10 | 11 | ## Requirements 12 | 13 | * Xcode 10 or later 14 | * iOS 8.0 or later 15 | * Swift 4.3 or later 16 | 17 | ## Features 18 | 19 | * Support XCode storybord 20 | 21 | ## Example 22 | 23 | Clone / download and open ```KSFacebookButtonExample.xcworkspace``` to see **KSFacebookButton** in action. 24 | Here are few examples: 25 | 26 | ![](README-Assets/example1.png) 27 | ![](README-Assets/example2.png) 28 | ![](README-Assets/example3.png) 29 | 30 | ## Installation 31 | 32 | ### CocoaPods 33 | ``` ruby 34 | pod 'KSFacebookButton' 35 | ``` 36 | 37 | ### Carthage 38 | ``` ruby 39 | github "LeeKahSeng/KSFacebookButton" 40 | ``` 41 | 1. After finish building the framework using Carthage, open XCode and select you project in the project navigator. 42 | 2. At ```Build Phases``` tab, add ```KSFacebookButton.framework``` to ```Link Binary with Libraries```. 43 | 3. At ```General``` tab, add ```KSFacebookButton.framework``` to ```Embedded Binaries```. 44 | 45 | **Note: If using Carthage for installation, ```IBDesignable``` and ```IBInspectable``` will not work due Xcode limitation. Details information can be found [here](https://github.com/Carthage/Carthage/issues/335).** 46 | 47 | ### Manually 48 | 1. Download the project. 49 | 2. Drag the ```Sources``` folder in ```\KSFacebookButton\KSFacebookButton``` into your XCode project. 50 | 3. Build & run. 51 | 52 | 53 | ## How to use 54 | ### Storyboard 55 | 1. Drag a UIButton to your view controller. 56 | 2. Open Indentity Inspector and change button class to KSFacebookButton. 57 | 3. Open Indentity Inspector and change button module to KSFacebookButton. (This step only required when install using CocoaPods or Carthage) 58 | 4. Open Attribute Inspector and select "Custom" as button type. 59 | 5. Change the button size, corner radius and title base on your needs using storyboard. 60 | 6. Build & run. 61 | 62 | ### Code 63 | Make sure you import KSFacebookButton if you are using CocoaPods or Carthage. 64 | ```swift 65 | import KSFacebookButton 66 | ``` 67 | KSFacebookButton can be initialize and configure just like normal UIButton. 68 | ```swift 69 | let facebookButton = KSFacebookButton(frame: CGRect(x: 20, y: 20, width: 200, height: 55)) 70 | facebookButton.cornerRadius = 3.0 71 | facebookButton.setTitle("Login with Facebook", for: .normal) 72 | facebookButton.addTarget(self, action: #selector(facebookButtonDidTapped(sender:)), for: .touchUpInside) 73 | view.addSubview(facebookButton) 74 | ``` 75 | 76 | ## License 77 | 78 | This code is distributed under the terms and conditions of the [MIT license](LICENSE). 79 | --------------------------------------------------------------------------------