├── .editorconfig ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .gitmodules ├── .jazzy.yaml ├── .prettierrc.yml ├── .swift-version ├── .swiftlint.yml ├── .travis.yml ├── Announcement.md ├── Brewfile ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Cartfile ├── Cartfile.resolved ├── Configurations ├── FacebookCore.modulemap ├── FacebookCore.xcconfig ├── FacebookLogin.xcconfig ├── FacebookShare.xcconfig ├── Shared │ ├── Common.xcconfig │ ├── Platform │ │ ├── iOS.xcconfig │ │ ├── macOS.xcconfig │ │ ├── tvOS.xcconfig │ │ └── watchOS.xcconfig │ ├── Product │ │ ├── Application.xcconfig │ │ ├── DynamicFramework.xcconfig │ │ ├── LogicTests.xcconfig │ │ └── StaticFramework.xcconfig │ ├── Project │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ └── Warnings.xcconfig └── Version.xcconfig ├── FacebookCore.podspec ├── FacebookLogin.podspec ├── FacebookShare.podspec ├── FacebookSwift.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── FacebookCore.xcscheme │ ├── FacebookLogin.xcscheme │ └── FacebookShare.xcscheme ├── FacebookSwift.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── WorkspaceSettings.xcsettings ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── MigrationGuide.md ├── README.md ├── ROADMAP.md ├── Rakefile ├── Resources └── Info.plist ├── SUPPORT.md ├── Samples └── Catalog │ ├── Configurations │ ├── Shared │ └── SwiftCatalog.xcconfig │ ├── Resources │ ├── Assets.xcassets │ │ ├── AppEventsIcon.imageset │ │ │ ├── AppEventsIcon.png │ │ │ └── Contents.json │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-1024.png │ │ │ ├── Icon-20.png │ │ │ ├── Icon-20@2x-1.png │ │ │ ├── Icon-20@2x.png │ │ │ ├── Icon-20@3x.png │ │ │ ├── Icon-40.png │ │ │ ├── Icon-40@2x.png │ │ │ ├── Icon-40@3x.png │ │ │ ├── Icon-60@2x.png │ │ │ ├── Icon-60@3x.png │ │ │ ├── Icon-72.png │ │ │ ├── Icon-72@2x.png │ │ │ ├── Icon-76.png │ │ │ ├── Icon-76@2x.png │ │ │ ├── Icon-83.5@2x.png │ │ │ ├── Icon-Small-50.png │ │ │ ├── Icon-Small-50@2x.png │ │ │ ├── Icon-Small.png │ │ │ ├── Icon-Small@2x.png │ │ │ ├── Icon-Small@3x.png │ │ │ ├── Icon.png │ │ │ └── Icon@2x.png │ │ ├── AppInvitesIcon.imageset │ │ │ ├── AppInvitesIcon.png │ │ │ └── Contents.json │ │ ├── AppLinksIcon.imageset │ │ │ ├── AppLinksIcon.png │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── GraphAPIIcon.imageset │ │ │ ├── Contents.json │ │ │ └── GraphAPIIcon.png │ │ ├── LaunchImage.launchimage │ │ │ ├── 1024x768.png │ │ │ ├── 1242x2208.png │ │ │ ├── 1536x2048.png │ │ │ ├── 2048x1536.png │ │ │ ├── 2208x1242.png │ │ │ ├── 640x1136.png │ │ │ ├── 640x960.png │ │ │ ├── 750x1334.png │ │ │ ├── 768x1024.png │ │ │ └── Contents.json │ │ ├── LoginIcon.imageset │ │ │ ├── Contents.json │ │ │ └── LoginIcon.png │ │ ├── ShareIcon.imageset │ │ │ ├── Contents.json │ │ │ └── ShareIcon.png │ │ ├── sky.dataset │ │ │ ├── Contents.json │ │ │ └── sky.mp4 │ │ └── sky.imageset │ │ │ ├── Contents.json │ │ │ └── sky.jpg │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── SwiftCatalog.entitlements │ ├── Sources │ ├── AppDelegate.swift │ ├── AppInviteViewController.swift │ ├── CustomAppEventViewController.swift │ ├── GraphAPIPostViewController.swift │ ├── GraphAPIReadViewController.swift │ ├── LoginButtonViewController.swift │ ├── LoginManagerViewController.swift │ ├── MainCollectionViewCell.swift │ ├── MainCollectionViewController.swift │ ├── ManualAppEventViewController.swift │ ├── ShareAPIViewController.swift │ ├── ShareDialogViewController.swift │ └── UIAlertController+Extensions.swift │ └── SwiftCatalog.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ └── xcschemes │ └── SwiftCatalog.xcscheme ├── Sources ├── Core │ ├── AccessToken.swift │ ├── Dictionary+KeyValueMap.swift │ ├── FBProfilePictureView.swift │ ├── FBSDKCoreKit+Typealiases.swift │ ├── Internal │ │ ├── FBSDKSettingsInitializer.h │ │ ├── FBSDKSettingsInitializer.m │ │ └── FacebookSwift-Bridging-Header.h │ ├── Permission.swift │ └── Settings.swift ├── Login │ ├── FBLoginButton.swift │ ├── FBSDKLoginKit+Typealiases.swift │ └── LoginManager.swift └── Share │ ├── Enums+Extensions.swift │ └── FBSDKShareKit+Typealiases.swift ├── Tests ├── FacebookCoreTests │ ├── FacebookCoreTests.swift │ └── Info.plist ├── FacebookLoginTests │ ├── FacebookLoginTests.swift │ └── Info.plist └── FacebookShareTests │ ├── FacebookShareTests.swift │ └── Info.plist └── scripts └── travis ├── before_install.sh ├── build_ios.sh ├── build_samples.sh ├── carthage.sh ├── cocoapods.sh ├── install.sh ├── lint.sh └── script.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_size = 2 8 | indent_style = space 9 | trim_trailing_whitespace = true 10 | 11 | [*.pbxproj] 12 | indent_size = 4 13 | indent_style = tab 14 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Project Owners 2 | * @jingping2015 @kalendae @joesus @shabbirv @sammy-sc @patters @wanaya @jawwad @kennymeyers @jgrandelli @ajfigueroa @Priyanka- @davidrothera @shergin @nightsd01 @alonsogc @nubbel @yu-w @tomw @yannickl @kartast @DimaVartanian @ericjkunz @moaleagha @nevsi @icepat @ijak @gbarcena @jasonhotsauce @mosheberman @compnerd 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Report an issue that you're running into 4 | labels: bug 5 | --- 6 | 7 | ## Checklist 8 | 9 | - [ ] I've updated to the latest released version of the SDK 10 | - [ ] I've searched for existing [GitHub issues](https://github.com/facebook/facebook-swift-sdk/issues) 11 | - [ ] I've looked for existing answers on [Stack Overflow](https://facebook.stackoverflow.com) and the [Facebook Developers Group](https://www.facebook.com/groups/fbdevelopers) 12 | - [ ] I've read the [Code of Conduct](CODE_OF_CONDUCT.md) 13 | - [ ] This issue is not security related and can safely be disclosed publicly on GitHub 14 | 15 | ## Environment 16 | 17 | Describe your dev environment here, giving as many details as possible. If you have them, make sure to include: 18 | 19 | - Xcode Version: `X.X.X` 20 | - Swift Version: `X.X.X` 21 | - Installation Platform & Verison: `[Cocoapods|Carthage|Manual]` version `X.X.X` 22 | 23 | ## Goals 24 | 25 | What do you want to achieve? 26 | 27 | ## Expected Results 28 | 29 | What do you expect to happen? 30 | 31 | ## Actual Results 32 | 33 | What actually happened? Can you provide a stack trace? 34 | 35 | ## Steps to Reproduce 36 | 37 | What are the steps necessary to reproduce this issue? 38 | 39 | ## Code Samples & Details 40 | 41 | Please provide a code sample, as well as any additional details, to help us track down the issue. If you can provide a link to a test project that allows us to reproduce the issue, this helps us immensely in both the speed and quality of the fix. 42 | 43 | **Note:** Remember to format your code for readability: 44 | 45 | ```swift 46 | // INSERT YOUR CODE HERE 47 | 48 | var example = "Example code" 49 | ``` 50 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Tell us something you want to see in this project 4 | labels: enhancement 5 | --- 6 | 7 | ## Checklist 8 | 9 | - [ ] I've updated to the latest released version of the SDK 10 | - [ ] I've searched for existing feature requests on [GitHub issues](https://github.com/facebook/facebook-swift-sdk/issues) 11 | - [ ] I've read the [Code of Conduct](CODE_OF_CONDUCT.md) 12 | - [ ] I've given my issue the title: `Feature Request: [name of my feature request]` 13 | 14 | ## Goals 15 | 16 | What do you want to achieve? 17 | 18 | ## Expected Results 19 | 20 | What do you expect to happen? 21 | 22 | ## Code Samples & Details 23 | 24 | Please provide a code sample, as well as any additional details, to help us track down the issue. If you can provide a link to a test project that allows us to reproduce the issue, this helps us immensely in both the speed and quality of the fix. 25 | 26 | **Note:** Remember to format your code for readability: 27 | 28 | ```swift 29 | // INSERT YOUR CODE HERE 30 | 31 | var example = "Example code" 32 | ``` 33 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Checklist 2 | 3 | - [ ] I've read the [Contributing Guidelines](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md) 4 | - [ ] I've completed the [Contributor License Agreement](https://developers.facebook.com/opensource/cla) 5 | - [ ] I've ensured that all existing tests pass and added tests (when/where necessary) 6 | - [ ] I've ensured that my code lints properly: (`swiftlint && swiftlint autocorrect --format`) 7 | - [ ] I've updated the documentation (when/where necessary) and [Changelog](CHANGELOG.md) (when/where necessary) 8 | - [ ] I've added the proper label to this pull request (e.g. `bug` for bug fixes) 9 | 10 | ## Pull Request Details 11 | 12 | Describe what you accomplished in this pull request 13 | 14 | ## Test Plan 15 | 16 | Test Plan: **Add your test plan here** 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## OS X 2 | .DS_Store 3 | 4 | ## Build generated 5 | build/ 6 | DerivedData 7 | 8 | ## Various settings 9 | *.pbxuser 10 | !default.pbxuser 11 | *.mode1v3 12 | !default.mode1v3 13 | *.mode2v3 14 | !default.mode2v3 15 | *.perspectivev3 16 | !default.perspectivev3 17 | xcuserdata 18 | 19 | ## Other 20 | *.xccheckout 21 | *.moved-aside 22 | *.xcuserstate 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | 29 | ## Dependency Managers 30 | Pods/ 31 | Carthage/Build 32 | 33 | ## AppCode 34 | .idea/ 35 | 36 | ## Ignore Docs Folder 37 | docs/ 38 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Carthage/Checkouts/facebook-objc-sdk"] 2 | path = Carthage/Checkouts/facebook-objc-sdk 3 | url = https://github.com/facebook/facebook-objc-sdk.git 4 | -------------------------------------------------------------------------------- /.jazzy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | author: Facebook 3 | author_url: https://developers.facebook.com 4 | clean: true 5 | copyright: Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 6 | github_file_prefix: https://github.com/facebook/facebook-swift-sdk/tree/0.3.3 7 | github_url: https://github.com/facebook/facebook-swift-sdk 8 | hide_documentation_coverage: true 9 | module: FacebookCore 10 | module_version: 0.3.3 11 | output: docs 12 | podspec: FacebookCore.podspec 13 | readme: README.md 14 | skip_undocumented: true 15 | source_directory: Sources 16 | theme: fullwidth 17 | use_safe_filenames: true 18 | 19 | custom_categories: 20 | - children: 21 | - AccessToken 22 | - UserProfile 23 | - UserProfilePictureView 24 | - ApplicationDelegate 25 | - SDKSettings 26 | - SDKLoggingBehavior 27 | - SDKVersion 28 | name: Common 29 | - children: 30 | - AppEvent 31 | - AppEventName 32 | - AppEventParameterName 33 | - AppEventsLogger 34 | - AppEventLoggable 35 | - AppEventParameterValueType 36 | name: App Events 37 | - children: 38 | - LoginManager 39 | - LoginButton 40 | - LoginButtonDelegate 41 | - LoginBehavior 42 | - LoginDefaultAudience 43 | - LoginResult 44 | name: Facebook Login 45 | - children: 46 | - Permission 47 | - ReadPermission 48 | - PublishPermission 49 | name: Facebook Permissions 50 | - children: 51 | - GraphRequest 52 | - GraphRequestProtocol 53 | - GraphRequestResult 54 | - GraphRequestHTTPMethod 55 | - GraphResponse 56 | - GraphResponseProtocol 57 | - GraphRequestConnection 58 | - GraphRequestDataAttachment 59 | name: Graph API 60 | - children: 61 | - ShareButton 62 | - SendButton 63 | - LikeButton 64 | - LikeControl 65 | - LikableObject 66 | name: Sharing Buttons 67 | - children: 68 | - ShareDialog 69 | - ShareDialogMode 70 | - MessageDialog 71 | - ContentSharingDialogProtocol 72 | name: Sharing Dialogs 73 | - children: 74 | - LinkShareContent 75 | - Photo 76 | - PhotoShareContent 77 | - Video 78 | - VideoShareContent 79 | - Hashtag 80 | - ContentProtocol 81 | - ContentSharingResultProtocol 82 | - PostSharingResult 83 | name: Shareable Content 84 | - children: 85 | - OpenGraphObject 86 | - OpenGraphAction 87 | - OpenGraphShareContent 88 | - OpenGraphPropertyName 89 | - OpenGraphPropertyValue 90 | - OpenGraphPropertyContaining 91 | name: Share Custom Open Graph Stories 92 | - children: 93 | - GraphSharer 94 | - ShareError 95 | - ContentSharerResult 96 | - ContentSharingProtocol 97 | name: Sharing via Graph API 98 | - children: 99 | - AppInvite 100 | name: App Invites 101 | - children: 102 | - GameRequest 103 | name: Game Requests 104 | - children: 105 | - "==(_:_:)" 106 | name: Equality Helpers 107 | -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | --- 2 | printWidth: 120 3 | tabWidth: 2 4 | useTabs: false 5 | semi: false 6 | singleQuote: true 7 | jsxSingleQuote: true 8 | proseWrap: always 9 | endOfLine: lf 10 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 5.0 2 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | included: 2 | - Sources 3 | - Samples 4 | - Tests 5 | 6 | excluded: 7 | - Pods 8 | - Carthage 9 | - Carthage/facebook-objc-sdk/samples 10 | - Carthage/facebook-objc-sdk/vendor 11 | - Vendor 12 | 13 | cyclomatic_complexity: 11 14 | explicit_type_interface: 15 | excluded: 16 | - local 17 | file_header: 18 | required_pattern: | 19 | \/\/ Copyright \(c\) \d{4}-present, Facebook, Inc\. All rights reserved\. 20 | \/\/ 21 | \/\/ You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 22 | \/\/ copy, modify, and distribute this software in source code or binary form for use 23 | \/\/ in connection with the web services and APIs provided by Facebook\. 24 | \/\/ 25 | \/\/ As with any software that integrates with the Facebook platform, your use of 26 | \/\/ this software is subject to the Facebook Developer Principles and Policies 27 | \/\/ \[http:\/\/developers\.facebook\.com\/policy\/\]\. This copyright notice shall be 28 | \/\/ included in all copies or substantial portions of the software\. 29 | \/\/ 30 | \/\/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | \/\/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 32 | \/\/ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\. IN NO EVENT SHALL THE AUTHORS OR 33 | \/\/ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 34 | \/\/ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 35 | \/\/ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE\. 36 | identifier_name: 37 | excluded: 38 | - ok 39 | indentation: 2 40 | large_tuple: 3 41 | line_length: 120 42 | nesting: 43 | type_level: 2 44 | private_outlet: 45 | allow_private_set: true 46 | 47 | disabled_rules: 48 | - conditional_returns_on_newline 49 | - discouraged_object_literal 50 | - explicit_acl 51 | - explicit_enum_raw_value 52 | - explicit_top_level_acl 53 | - no_extension_access_modifier 54 | - number_separator 55 | - prefixed_toplevel_constant 56 | - switch_case_on_newline 57 | # TODO: All below to move to Opt In 58 | - discouraged_optional_boolean 59 | - discouraged_optional_collection 60 | - function_default_parameter_at_end 61 | - todo 62 | 63 | opt_in_rules: 64 | - array_init 65 | - attributes 66 | - block_based_kvo 67 | - class_delegate_protocol 68 | - closing_brace 69 | - closure_end_indentation 70 | - closure_parameter_position 71 | - closure_spacing 72 | - colon 73 | - comma 74 | - compiler_protocol_init 75 | - contains_over_first_not_nil 76 | - control_statement 77 | - convenience_type 78 | - cyclomatic_complexity 79 | - discarded_notification_center_observer 80 | - discouraged_direct_init 81 | - dynamic_inline 82 | - empty_count 83 | - empty_string 84 | - empty_enum_arguments 85 | - empty_parameters 86 | - empty_parentheses_with_trailing_closure 87 | - empty_xctest_method 88 | - explicit_init 89 | - explicit_type_interface 90 | - extension_access_modifier 91 | - fallthrough 92 | - fatal_error_message 93 | - file_header 94 | - file_length 95 | - file_name 96 | - first_where 97 | - for_where 98 | - force_cast 99 | - force_try 100 | - force_unwrapping 101 | - function_body_length 102 | - function_parameter_count 103 | - generic_type_name 104 | - identifier_name 105 | - implicit_getter 106 | - implicit_return 107 | - implicitly_unwrapped_optional 108 | - is_disjoint 109 | - joined_default_parameter 110 | - large_tuple 111 | - leading_whitespace 112 | - legacy_cggeometry_functions 113 | - legacy_constant 114 | - legacy_constructor 115 | - legacy_nsgeometry_functions 116 | - let_var_whitespace 117 | - line_length 118 | - literal_expression_end_indentation 119 | - lower_acl_than_parent 120 | - mark 121 | - modifier_order 122 | - multiline_arguments 123 | - multiline_function_chains 124 | - multiline_parameters 125 | - multiple_closures_with_trailing_closure 126 | - nesting 127 | - nimble_operator 128 | - no_fallthrough_only 129 | - no_grouping_extension 130 | - notification_center_detachment 131 | - object_literal 132 | - opening_brace 133 | - operator_usage_whitespace 134 | - operator_whitespace 135 | - overridden_super_call 136 | - override_in_extension 137 | - pattern_matching_keywords 138 | - private_action 139 | - private_outlet 140 | - private_over_fileprivate 141 | - private_unit_test 142 | - prohibited_super_call 143 | - protocol_property_accessors_order 144 | - quick_discouraged_call 145 | - quick_discouraged_focused_test 146 | - quick_discouraged_pending_test 147 | - redundant_discardable_let 148 | - redundant_nil_coalescing 149 | - redundant_optional_initialization 150 | - redundant_set_access_control 151 | - redundant_string_enum_value 152 | - redundant_void_return 153 | - required_enum_case 154 | - return_arrow_whitespace 155 | - shorthand_operator 156 | - single_test_class 157 | - sorted_first_last 158 | - sorted_imports 159 | - statement_position 160 | - strict_fileprivate 161 | - superfluous_disable_command 162 | - switch_case_alignment 163 | - syntactic_sugar 164 | - trailing_closure 165 | - trailing_comma 166 | - trailing_newline 167 | - trailing_semicolon 168 | - trailing_whitespace 169 | - type_body_length 170 | - type_name 171 | - unavailable_function 172 | - unneeded_break_in_switch 173 | - unneeded_parentheses_in_closure_argument 174 | - untyped_error_in_catch 175 | - unused_closure_parameter 176 | - unused_enumerated 177 | - unused_optional_binding 178 | - valid_ibinspectable 179 | - vertical_parameter_alignment 180 | - vertical_parameter_alignment_on_call 181 | - vertical_whitespace 182 | - void_return 183 | - weak_delegate 184 | - xctfail_message 185 | - yoda_condition 186 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | branches: 2 | only: 3 | - master 4 | language: objective-c 5 | os: osx 6 | osx_image: xcode10.2 7 | cache: 8 | - cocoapods 9 | env: 10 | matrix: 11 | - TEST_TYPE=iOS 12 | - TEST_TYPE=Lint 13 | - TEST_TYPE=Samples 14 | - TEST_TYPE=CocoaPods 15 | - TEST_TYPE=Carthage 16 | before_install: sh scripts/travis/before_install.sh 17 | install: sh scripts/travis/install.sh 18 | script: sh scripts/travis/script.sh 19 | -------------------------------------------------------------------------------- /Announcement.md: -------------------------------------------------------------------------------- 1 | # Retiring the Standalone Swift SDK 2 | 3 | In 2016 we created a Swift SDK with the goal of adding a Swiftier interface to our existing Objective-C (ObjC) SDK. This SDK was designed to be a wrapper around the ObjC SDK. The longer-term idea was to use this as a basis for a fully native Swift SDK; depending on the ObjC SDK less and less until the dependency could be inverted and the ObjC SDK would depend on the Swift SDK. Ultimately we would be able to get rid of the ObjC SDK entirely. 4 | 5 | After careful consideration we have made the decision to abandon this course of action. We are moving the Swift files in this repository to the ObjC repository. Since we have always relied on the Swift interface provided by the ObjC SDK, this move formalizes that relationship. 6 | 7 | There are a few good reasons to collocate these files. 8 | 9 | 10 | 1. Reduce confusion - a number of bug reports received in this project are actually bugs in the ObjC implementation 11 | 2. Make documentation easier - many of the documentation tools do not easily pull in dependencies, this simplifies that problem 12 | 3. One SDK for both Swift and Objective-C 13 | 4. Synch up releases - currently a bug fix released to the ObjC SDK is not automatically released to the Swift SDK. This resulted in a lot of confusion that can be avoided in the future. See: [issue 458](https://github.com/facebook/facebook-swift-sdk/issues/458) 14 | 5. Simplify distribution - while distribution will be more complicated in the short term, longer term distribution will be simpler 15 | 6. Enable native implementation. Starting to mix Swift and ObjC files now paves the way for a native Swift implementation once we drop support for Xcode 10.2 16 | 17 | ## Timeline 18 | 19 | We plan on archiving this repo on November 1, 2019. This gives users one month to follow the instructions below for migrating to the new source code location. At this time we will also deprecate the CocoaPods `FacebookCore`, `FacebookLogin`, and `FacebookShare`. 20 | 21 | ## Migration Guide 22 | See our [Migration Guide](MigrationGuide.md) for instructions on how to move to the new code base! 23 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | brew 'carthage' 2 | brew 'swiftlint' 3 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text at 4 | [code.facebook.com/codeofconduct](https://code.facebook.com/codeofconduct) so that you can understand what actions will 5 | and will not be tolerated. 6 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Facebook Swift SDK 2 | 3 | We want to make contributing to this project as easy and transparent as possible. 4 | 5 | ## Code of Conduct 6 | 7 | The code of conduct is described in the [Code of Conduct](CODE_OF_CONDUCT.md). 8 | 9 | ## Pull Requests 10 | 11 | We actively welcome your pull requests. 12 | 13 | 1. Fork the repo and create your branch from `master`. 14 | 2. If you've added code that should be tested, add tests. 15 | 3. If you've changed APIs, update the documentation. 16 | 4. Ensure the test suite passes. 17 | 5. Make sure your code lints. 18 | 6. If you haven't already, complete the Contributor License Agreement ("CLA"). 19 | 20 | ## Contributor License Agreement ("CLA") 21 | 22 | In order to accept your pull request, we need you to submit a CLA. You only need to do this once to work on any of 23 | Facebook's open source projects. 24 | 25 | Complete your CLA here: [developers.facebook.com/opensource/cla](https://developers.facebook.com/opensource/cla) 26 | 27 | ## Issues 28 | 29 | We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be 30 | able to reproduce the issue. 31 | 32 | Facebook has a [bounty program](https://www.facebook.com/whitehat) for the safe disclosure of security bugs. In those 33 | cases, please go through the process outlined on that page and do not file a public issue. 34 | 35 | ## Coding Style 36 | 37 | - Most importantly, match the existing code style as much as possible. 38 | - Try to keep lines under 120 characters, if possible. 39 | 40 | ## License 41 | 42 | See the [`LICENSE`](https://github.com/facebook/facebook-swift-sdk/blob/master/LICENSE) file. 43 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "facebook/facebook-objc-sdk" ~> 5.0 2 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "facebook/facebook-objc-sdk" "v5.5.0" 2 | -------------------------------------------------------------------------------- /Configurations/FacebookCore.modulemap: -------------------------------------------------------------------------------- 1 | framework module FacebookCore { 2 | umbrella header "FacebookCore.h" 3 | } 4 | -------------------------------------------------------------------------------- /Configurations/FacebookCore.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #include "Shared/Platform/iOS.xcconfig" 20 | #include "Shared/Product/DynamicFramework.xcconfig" 21 | #include "Version.xcconfig" 22 | 23 | PRODUCT_NAME = FacebookCore 24 | PRODUCT_BUNDLE_IDENTIFIER = com.facebook.swift.core 25 | 26 | SWIFT_VERSION = 5.0 27 | 28 | IPHONEOS_DEPLOYMENT_TARGET = 8.0 29 | 30 | INFOPLIST_FILE = $(SRCROOT)/Resources/Info.plist 31 | 32 | // Enable testability to make internal things visible with @testable import 33 | ENABLE_TESTABILITY = YES 34 | -------------------------------------------------------------------------------- /Configurations/FacebookLogin.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #include "Shared/Platform/iOS.xcconfig" 20 | #include "Shared/Product/DynamicFramework.xcconfig" 21 | #include "Version.xcconfig" 22 | 23 | PRODUCT_NAME = FacebookLogin 24 | PRODUCT_BUNDLE_IDENTIFIER = com.facebook.swift.login 25 | 26 | SWIFT_VERSION = 5.0 27 | 28 | IPHONEOS_DEPLOYMENT_TARGET = 8.0 29 | 30 | INFOPLIST_FILE = $(SRCROOT)/Resources/Info.plist 31 | -------------------------------------------------------------------------------- /Configurations/FacebookShare.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #include "Shared/Platform/iOS.xcconfig" 20 | #include "Shared/Product/DynamicFramework.xcconfig" 21 | #include "Version.xcconfig" 22 | 23 | PRODUCT_NAME = FacebookShare 24 | PRODUCT_BUNDLE_IDENTIFIER = com.facebook.swift.share 25 | 26 | SWIFT_VERSION = 5.0 27 | 28 | IPHONEOS_DEPLOYMENT_TARGET = 8.0 29 | 30 | INFOPLIST_FILE = $(SRCROOT)/Resources/Info.plist 31 | -------------------------------------------------------------------------------- /Configurations/Shared/Common.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #include "Warnings.xcconfig" 20 | 21 | // Disable legacy-compatible header searching 22 | ALWAYS_SEARCH_USER_PATHS = NO 23 | 24 | // Architectures to build 25 | ARCHS = $(ARCHS_STANDARD) 26 | 27 | // Whether to enable module imports 28 | CLANG_ENABLE_MODULES = YES 29 | CLANG_ENABLE_MODULE_DEBUGGING = NO 30 | 31 | // Build Options 32 | CLANG_ENABLE_OBJC_ARC = YES 33 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0 34 | 35 | // Whether to strip out code that isn't called from anywhere 36 | DEAD_CODE_STRIPPING = NO 37 | 38 | // The format of debugging symbols 39 | DEBUG_INFORMATION_FORMAT = dwarf-with-dsym 40 | 41 | // C Language 42 | GCC_C_LANGUAGE_STANDARD = gnu11 43 | 44 | // C++ Language 45 | CLANG_CXX_LANGUAGE_STANDARD = gnu++14 46 | CLANG_CXX_LIBRARY = libc++ 47 | 48 | // Code Generation 49 | GCC_DYNAMIC_NO_PIC = NO 50 | GCC_INLINES_ARE_PRIVATE_EXTERN = YES 51 | GCC_NO_COMMON_BLOCKS = YES 52 | GCC_SYMBOLS_PRIVATE_EXTERN = NO 53 | 54 | // Static Analyzer - Analysis Policy 55 | RUN_CLANG_STATIC_ANALYZER = YES 56 | CLANG_STATIC_ANALYZER_MODE_ON_ANALYZE_ACTION = deep 57 | CLANG_STATIC_ANALYZER_MODE = shallow 58 | -------------------------------------------------------------------------------- /Configurations/Shared/Platform/iOS.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | SDKROOT = iphoneos 20 | IPHONEOS_DEPLOYMENT_TARGET = 7.0 21 | 22 | // Supported device families (1 is iPhone, 2 is iPad, 3 is Apple TV) 23 | TARGETED_DEVICE_FAMILY = 1,2 24 | 25 | // Where to find embedded frameworks 26 | LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks 27 | -------------------------------------------------------------------------------- /Configurations/Shared/Platform/macOS.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | SDKROOT = macosx 20 | MACOSX_DEPLOYMENT_TARGET = 10.9 21 | 22 | // Where to find embedded frameworks 23 | LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks 24 | -------------------------------------------------------------------------------- /Configurations/Shared/Platform/tvOS.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | SDKROOT = appletvos 20 | TVOS_DEPLOYMENT_TARGET = 9.0 21 | 22 | // Supported device families (1 is iPhone, 2 is iPad, 3 is Apple TV) 23 | TARGETED_DEVICE_FAMILY = 3 24 | 25 | // Where to find embedded frameworks 26 | LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks 27 | -------------------------------------------------------------------------------- /Configurations/Shared/Platform/watchOS.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | SDKROOT = watchos 20 | WATCHOS_DEPLOYMENT_TARGET = 2.0 21 | 22 | // Supported device families (1 is iPhone, 2 is iPad, 3 is Apple TV, 4 is watch) 23 | TARGETED_DEVICE_FAMILY = 4 24 | 25 | // Where to find embedded frameworks 26 | LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks 27 | -------------------------------------------------------------------------------- /Configurations/Shared/Product/Application.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | // Whether to strip out code that isn't called from anywhere 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon 23 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage 24 | 25 | LD_RUNPATH_SEARCH_PATHS = $(inherited) @loader_path/Frameworks @executable_path/Frameworks 26 | -------------------------------------------------------------------------------- /Configurations/Shared/Product/DynamicFramework.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | // Dynamic frameworks are backed by dynamic library. 20 | MACH_O_TYPE = mh_dylib 21 | 22 | // Whether this framework should define an LLVM module 23 | DEFINES_MODULE = YES 24 | 25 | // Disable clang modules autolink 26 | CLANG_MODULES_AUTOLINK = NO 27 | 28 | // Whether to strip out code that isn't called from anywhere 29 | DEAD_CODE_STRIPPING = NO 30 | 31 | // Whether function calls should be position-dependent (should always be disabled for shared code) 32 | GCC_DYNAMIC_NO_PIC = NO 33 | 34 | // Don't include in an xcarchive 35 | SKIP_INSTALL = YES 36 | 37 | // Don't install in any specific location 38 | INSTALL_PATH = 39 | 40 | // Do not require code signing 41 | CODE_SIGNING_REQUIRED = NO 42 | 43 | // Disable code signing 44 | CODE_SIGN_IDENTITY = 45 | 46 | // Enables the framework to be included from any location as long as the loader’s runpath search paths includes it. 47 | // For example from an application bundle (inside the "Frameworks" folder) or shared folder. 48 | LD_DYLIB_INSTALL_NAME = @rpath/$(PRODUCT_NAME).$(WRAPPER_EXTENSION)/$(PRODUCT_NAME) 49 | DYLIB_INSTALL_NAME_BASE = @rpath 50 | -------------------------------------------------------------------------------- /Configurations/Shared/Product/LogicTests.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | BUNDLE_LOADER = $(TEST_HOST) 20 | 21 | OTHER_LDFLAGS = $(inherited) -ObjC -framework XCTest 22 | -------------------------------------------------------------------------------- /Configurations/Shared/Product/StaticFramework.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | // Static frameworks are backed by static libraries 20 | MACH_O_TYPE = staticlib 21 | 22 | // Whether this framework should define an LLVM module 23 | DEFINES_MODULE = YES 24 | 25 | // Disable clang modules autolink 26 | CLANG_MODULES_AUTOLINK = NO 27 | 28 | // Whether to strip out code that isn't called from anywhere 29 | DEAD_CODE_STRIPPING = NO 30 | 31 | // Whether function calls should be position-dependent (should always be disabled for shared code) 32 | GCC_DYNAMIC_NO_PIC = NO 33 | 34 | // Enables the framework to be included from any location as long as the loader’s runpath search paths includes it. 35 | // For example from an application bundle (inside the "Frameworks" folder) or shared folder 36 | INSTALL_PATH = @rpath 37 | 38 | // Don't include in an xcarchive 39 | SKIP_INSTALL = YES 40 | 41 | // Do not require code signing 42 | CODE_SIGNING_REQUIRED = NO 43 | 44 | // Disable code signing 45 | CODE_SIGN_IDENTITY = 46 | -------------------------------------------------------------------------------- /Configurations/Shared/Project/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #include "../Common.xcconfig" 20 | 21 | // Architectures 22 | ONLY_ACTIVE_ARCH = YES 23 | 24 | // Optimization 25 | GCC_OPTIMIZATION_LEVEL = 0 26 | SWIFT_OPTIMIZATION_LEVEL = -Onone 27 | 28 | // Preprocessor 29 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited) 30 | ENABLE_NS_ASSERTIONS = YES 31 | 32 | // Testability 33 | ENABLE_TESTABILITY = YES 34 | 35 | // Deployment 36 | COPY_PHASE_STRIP = NO 37 | 38 | SANITIZE_FLAGS = -fsanitize-undefined-trap-on-error -fsanitize=undefined-trap 39 | OTHER_CFLAGS = $(value) $(SANITIZE_FLAGS) 40 | OTHER_LDFLAGS = $(value) $(SANITIZE_FLAGS) 41 | -------------------------------------------------------------------------------- /Configurations/Shared/Project/Release.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #include "../Common.xcconfig" 20 | 21 | // Architectures 22 | ONLY_ACTIVE_ARCH = NO 23 | 24 | // Build 25 | VALIDATE_PRODUCT = YES 26 | 27 | // Optimization 28 | GCC_OPTIMIZATION_LEVEL = s 29 | SWIFT_OPTIMIZATION_LEVEL = -Owholemodule 30 | 31 | // Preprocessor 32 | ENABLE_NS_ASSERTIONS = NO 33 | 34 | // Deployment 35 | DEPLOYMENT_POSTPROCESSING = YES 36 | COPY_PHASE_STRIP = YES 37 | STRIP_STYLE = debugging 38 | STRIP_INSTALLED_PRODUCT = YES 39 | -------------------------------------------------------------------------------- /Configurations/Shared/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | ENABLE_STRICT_OBJC_MSGSEND = YES 20 | 21 | GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES 22 | GCC_WARN_ABOUT_MISSING_NEWLINE = YES 23 | GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES 24 | GCC_WARN_CHECK_SWITCH_STATEMENTS = YES 25 | GCC_WARN_MISSING_PARENTHESES = YES 26 | GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES 27 | GCC_WARN_UNKNOWN_PRAGMAS = YES 28 | GCC_WARN_UNUSED_FUNCTION = YES 29 | GCC_WARN_UNUSED_LABEL = YES 30 | GCC_WARN_UNUSED_VALUE = YES 31 | GCC_WARN_UNUSED_VARIABLE = YES 32 | GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES 33 | GCC_WARN_UNDECLARED_SELECTOR = YES 34 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES 35 | GCC_WARN_UNINITIALIZED_AUTOS = YES 36 | GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES 37 | GCC_WARN_SHADOW = YES 38 | 39 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES 40 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 41 | CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES 42 | CLANG_WARN_BOOL_CONVERSION = YES 43 | CLANG_WARN_CONSTANT_CONVERSION = YES 44 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES 45 | CLANG_WARN_EMPTY_BODY = YES 46 | CLANG_WARN_ENUM_CONVERSION = YES 47 | CLANG_WARN_UNREACHABLE_CODE = YES 48 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 49 | CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES 50 | CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES 51 | CLANG_WARN_BOOL_CONVERSION = YES 52 | CLANG_WARN_INFINITE_RECURSION = YES 53 | CLANG_WARN_SUSPICIOUS_MOVE = YES 54 | 55 | // Errors 56 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR 57 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR 58 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR 59 | 60 | // Static Analyzer Warnings 61 | CLANG_ANALYZER_NONNULL = YES 62 | CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES 63 | 64 | // 65 | // Extra warnings, not available directly in build settings. 66 | // 'auto-import' - warns when an old-style hashed import could be replaced with modular import aka @import. 67 | // 'switch-enum' - enforces explicit handling of cases in switch statements. 68 | // 'method-signatures' - enforces method signatures to always match. 69 | // 'idiomatic-parentheses' - do not allow usage of an assignment as a condition without extra paranthesis. 70 | // 'covered-switch-default' - warns when implementing 'default' case in switch statement that covers all options. 71 | // 'custom-atomic-properties' - safeguards atomic properties with custom implementations. 72 | // 'cstring-format-directive' - do not allow NSString * to be used as c-string formatting argument aka '%s'. 73 | // 'conditional-uninitialized' - warn about potential use of of uninitialized variables. 74 | // 'unused-exception-parameter' - @try @catch without usage of exception parameter. 75 | // 'missing-variable-declarations' - will mark all variables that are missing declarations, including non-static extern constants. 76 | // 77 | WARNING_CFLAGS = $(inherited) -Wswitch-enum -Wmethod-signatures -Widiomatic-parentheses -Wcustom-atomic-properties -Wconditional-uninitialized -Wunused-exception-parameter -Wmissing-variable-declarations 78 | -------------------------------------------------------------------------------- /Configurations/Version.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | FBSDK_SWIFT_VERSION = 0.9.0 20 | -------------------------------------------------------------------------------- /FacebookCore.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "FacebookCore" 3 | s.version = "0.9.0" 4 | s.author = "Facebook" 5 | s.homepage = "https://developers.facebook.com/docs/swift" 6 | s.documentation_url = "https://developers.facebook.com/docs/swift/reference" 7 | s.license = { :type => "Facebook Platform License", :file => "LICENSE" } 8 | 9 | s.summary = "Official Facebook SDK in Swift to access Facebook Platform's core features." 10 | 11 | s.source = { :git => "https://github.com/facebook/facebook-swift-sdk.git", :tag => "v#{s.version}" } 12 | 13 | s.requires_arc = true 14 | s.platform = :ios 15 | 16 | s.swift_version = "5.0" 17 | 18 | s.ios.deployment_target = "8.0" 19 | 20 | s.source_files = "Sources/Core/**/*.swift" 21 | s.module_name = "FacebookCore" 22 | s.pod_target_xcconfig = { "ENABLE_TESTABILITY" => "YES" } 23 | 24 | s.ios.dependency "FBSDKCoreKit", "~> 5.0" 25 | end 26 | -------------------------------------------------------------------------------- /FacebookLogin.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "FacebookLogin" 3 | s.version = "0.9.0" 4 | s.author = "Facebook" 5 | s.homepage = "https://developers.facebook.com/docs/swift" 6 | s.documentation_url = "https://developers.facebook.com/docs/swift/reference" 7 | s.license = { :type => "Facebook Platform License", :file => "LICENSE" } 8 | 9 | s.summary = "Official Facebook SDK in Swift to integrate with Facebook Login." 10 | 11 | s.source = { :git => "https://github.com/facebook/facebook-swift-sdk.git", :tag => "v#{s.version}" } 12 | 13 | s.requires_arc = true 14 | s.platform = :ios 15 | 16 | s.swift_version = "5.0" 17 | 18 | s.ios.deployment_target = "8.0" 19 | 20 | s.source_files = "Sources/Login/**/*.swift" 21 | s.exclude_files = "Sources/Login/LoginManager.DefaultAudience.swift" 22 | s.module_name = "FacebookLogin" 23 | 24 | s.ios.dependency "FacebookCore", "~> #{s.version}" 25 | s.ios.dependency "FBSDKCoreKit", "~> 5.0" 26 | s.ios.dependency "FBSDKLoginKit", "~> 5.0" 27 | end 28 | -------------------------------------------------------------------------------- /FacebookShare.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "FacebookShare" 3 | s.version = "0.9.0" 4 | s.author = "Facebook" 5 | s.homepage = "https://developers.facebook.com/docs/swift" 6 | s.documentation_url = "https://developers.facebook.com/docs/swift/reference" 7 | s.license = { :type => "Facebook Platform License", :file => "LICENSE" } 8 | 9 | s.summary = "Official Facebook SDK in Swift to access Facebook Platform's Sharing Features." 10 | 11 | s.source = { :git => "https://github.com/facebook/facebook-swift-sdk.git", :tag => "v#{s.version}" } 12 | 13 | s.requires_arc = true 14 | s.platform = :ios 15 | 16 | s.swift_version = "5.0" 17 | 18 | s.ios.deployment_target = "8.0" 19 | 20 | s.source_files = "Sources/Share/**/*.swift" 21 | s.module_name = "FacebookShare" 22 | 23 | s.ios.dependency "FacebookCore", "~> #{s.version}" 24 | s.ios.dependency "FBSDKCoreKit", "~> 5.0" 25 | s.ios.dependency "FBSDKShareKit", "~> 5.0" 26 | end 27 | -------------------------------------------------------------------------------- /FacebookSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FacebookSwift.xcodeproj/xcshareddata/xcschemes/FacebookCore.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 | -------------------------------------------------------------------------------- /FacebookSwift.xcodeproj/xcshareddata/xcschemes/FacebookLogin.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 | -------------------------------------------------------------------------------- /FacebookSwift.xcodeproj/xcshareddata/xcschemes/FacebookShare.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 | -------------------------------------------------------------------------------- /FacebookSwift.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 10 | 12 | 13 | 14 | 17 | 19 | 20 | 22 | 23 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /FacebookSwift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /FacebookSwift.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rake' 4 | gem 'jazzy' 5 | gem 'cocoapods' 6 | gem 'xcpretty' 7 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.0) 5 | activesupport (4.2.11) 6 | i18n (~> 0.7) 7 | minitest (~> 5.1) 8 | thread_safe (~> 0.3, >= 0.3.4) 9 | tzinfo (~> 1.1) 10 | atomos (0.1.3) 11 | claide (1.0.2) 12 | cocoapods (1.6.1) 13 | activesupport (>= 4.0.2, < 5) 14 | claide (>= 1.0.2, < 2.0) 15 | cocoapods-core (= 1.6.1) 16 | cocoapods-deintegrate (>= 1.0.2, < 2.0) 17 | cocoapods-downloader (>= 1.2.2, < 2.0) 18 | cocoapods-plugins (>= 1.0.0, < 2.0) 19 | cocoapods-search (>= 1.0.0, < 2.0) 20 | cocoapods-stats (>= 1.0.0, < 2.0) 21 | cocoapods-trunk (>= 1.3.1, < 2.0) 22 | cocoapods-try (>= 1.1.0, < 2.0) 23 | colored2 (~> 3.1) 24 | escape (~> 0.0.4) 25 | fourflusher (>= 2.2.0, < 3.0) 26 | gh_inspector (~> 1.0) 27 | molinillo (~> 0.6.6) 28 | nap (~> 1.0) 29 | ruby-macho (~> 1.4) 30 | xcodeproj (>= 1.8.1, < 2.0) 31 | cocoapods-core (1.6.1) 32 | activesupport (>= 4.0.2, < 6) 33 | fuzzy_match (~> 2.0.4) 34 | nap (~> 1.0) 35 | cocoapods-deintegrate (1.0.3) 36 | cocoapods-downloader (1.2.2) 37 | cocoapods-plugins (1.0.0) 38 | nap 39 | cocoapods-search (1.0.0) 40 | cocoapods-stats (1.1.0) 41 | cocoapods-trunk (1.3.1) 42 | nap (>= 0.8, < 2.0) 43 | netrc (~> 0.11) 44 | cocoapods-try (1.1.0) 45 | colored2 (3.1.2) 46 | concurrent-ruby (1.1.4) 47 | escape (0.0.4) 48 | ffi (1.10.0) 49 | fourflusher (2.2.0) 50 | fuzzy_match (2.0.4) 51 | gh_inspector (1.1.3) 52 | i18n (0.9.5) 53 | concurrent-ruby (~> 1.0) 54 | jazzy (0.9.4) 55 | cocoapods (~> 1.0) 56 | mustache (~> 0.99) 57 | open4 58 | redcarpet (~> 3.2) 59 | rouge (>= 2.0.6, < 4.0) 60 | sass (~> 3.4) 61 | sqlite3 (~> 1.3) 62 | xcinvoke (~> 0.3.0) 63 | liferaft (0.0.6) 64 | minitest (5.11.3) 65 | molinillo (0.6.6) 66 | mustache (0.99.8) 67 | nanaimo (0.2.6) 68 | nap (1.1.0) 69 | netrc (0.11.0) 70 | open4 (1.3.4) 71 | rake (12.3.2) 72 | rb-fsevent (0.10.3) 73 | rb-inotify (0.10.0) 74 | ffi (~> 1.0) 75 | redcarpet (3.4.0) 76 | rouge (2.0.7) 77 | ruby-macho (1.4.0) 78 | sass (3.7.3) 79 | sass-listen (~> 4.0.0) 80 | sass-listen (4.0.0) 81 | rb-fsevent (~> 0.9, >= 0.9.4) 82 | rb-inotify (~> 0.9, >= 0.9.7) 83 | sqlite3 (1.4.0) 84 | thread_safe (0.3.6) 85 | tzinfo (1.2.5) 86 | thread_safe (~> 0.1) 87 | xcinvoke (0.3.0) 88 | liferaft (~> 0.0.6) 89 | xcodeproj (1.8.1) 90 | CFPropertyList (>= 2.3.3, < 4.0) 91 | atomos (~> 0.1.3) 92 | claide (>= 1.0.2, < 2.0) 93 | colored2 (~> 3.1) 94 | nanaimo (~> 0.2.6) 95 | xcpretty (0.3.0) 96 | rouge (~> 2.0.7) 97 | 98 | PLATFORMS 99 | ruby 100 | 101 | DEPENDENCIES 102 | cocoapods 103 | jazzy 104 | rake 105 | xcpretty 106 | 107 | BUNDLED WITH 108 | 1.17.2 109 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | 3 | For Facebook Swift SDK software 4 | 5 | You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 6 | copy, modify, and distribute this software in source code or binary form for use 7 | in connection with the web services and APIs provided by Facebook. 8 | 9 | As with any software that integrates with the Facebook platform, your use of 10 | this software is subject to the Facebook Developer Principles and Policies 11 | [http://developers.facebook.com/policy/]. This copyright notice shall be 12 | included in all copies or substantial portions of the software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /MigrationGuide.md: -------------------------------------------------------------------------------- 1 | # Migration Guide 2 | 3 | This guide shows how to migrate to the new framework using CocoaPods, Carthage, or manually using the frameworks. 4 | 5 | 6 | ### Using Cocoapods 7 | 8 | Change the entries in the pod file. 9 | 10 | | Old way | New way | 11 | | :--- | :--- | 12 | | pod 'FacebookCore' | pod 'FBSDKCoreKit/Swift' | 13 | | pod 'FacebookLogin' | pod 'FBSDKLoginKit/Swift' | 14 | | pod 'FacebookShare' | pod 'FBSDKShareKit/Swift' | 15 | 16 | 17 | ### Using Carthage 18 | 19 | We are choosing to not support Carthage for the Swift libraries until we drop support for Xcode 10.2. There are two main reasons for this: 20 | 21 | a) After we drop support for Xcode 10.2, we can get rid of the concept of separate libraries and our existing tooling around Carthage will 'just work' 22 | 23 | b) Building on (a), we plan on supporting Swift Package Manager in the near future and as a small team, it makes more sense to put our time towards that effort. 24 | 25 | Carthage will continue to work against this codebase but you will not receive any updates. 26 | 27 | If your goal is simply to link with prebuilt dynamic libraries, those can be found [here](https://github.com/facebook/facebook-ios-sdk/releases) in the file `SwiftDynamic.zip`. You will notice that the library names have changed, and the module names have changed. You can consume these in the same way you were previously consuming the libraries procured by Carthage. 28 | 29 | | Old Library / Module Name | New Library / Module Name | 30 | | :--- | :--- | 31 | | FacebookCore | FBSDKCoreKit | 32 | | FacebookLogin | FBSDKLoginKit | 33 | | FacebookShare | FBSDKShareKit | 34 | 35 | 36 | ### Manual Way 37 | 38 | Under the [releases](https://github.com/facebook/facebook-objc-sdk/releases) tab on GitHub you'll find a file named `FBSDKCoreKit-Swift.zip` (similar naming exists for Login and Share). If you unzip that you'll find `FBSDKCoreKit.framework`. This is the version of the framework that includes the Swift interface. You can confirm this by inspecting it in Finder. You will see a Modules folder that includes `FBSDKCoreKit.swiftmodule`. 39 | 40 | Consume this in the way you would consume any other static binary framework. 41 | 42 | 43 | ## Usage 44 | 45 | Nothing is changing from a usage / naming / API perspective. The only change is the module name. 46 | 47 | | Old Module Name | New Module Name | 48 | | :--- | :--- | 49 | | FacebookCore | FBSDKCoreKit | 50 | | FacebookLogin | FBSDKLoginKit | 51 | | FacebookShare | FBSDKShareKit | 52 | 53 | Import the module using the following statement. 54 | 55 | The old way to import the module: 56 | 57 | | Old Way | New Way | 58 | | :--- | :--- | 59 | | import FacebookCore | import FBSDKCoreKit | 60 | 61 | **IMPORTANT** 62 | 63 | The exception to this rule is for using Swift Package Manager. In this case the imports will stay the same. Currently SPM is unreleased but is available on the master branch of the iOS repository. Use at your own risk until it is formally released. 64 | 65 | ## Q & A 66 | 67 | Q: Do I need to make this change? 68 | 69 | A: Technically no but if you do not make this change, you will miss out on important fixes that may impact performance, security, and stability as well as new features. You will also open yourself up to rejection from the App Store as you will not receive fixes required by Apple. For instance, the change from UIWebView to WKWebView. 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The Facebook Swift SDK is Moved 2 | 3 | ## Please see our [Announcement](Announcement.md) regarding this decision and our [Migration Guide](MigrationGuide.md) to help transition to the [Facebook iOS SDK](https://github.com/facebook/facebook-ios-sdk). 4 | -------------------------------------------------------------------------------- /ROADMAP.md: -------------------------------------------------------------------------------- 1 | # Roadmap 2 | 3 | #### Background 4 | A few facts to consider: 5 | 6 | * The Swift SDK has not been a focus in the recent past. 7 | * Despite working on Swift projects, the majority of our iOS developers are either unaware of the [Swift SDK](https://github.com/facebook/facebook-swift-sdk) or choose to use the [Objective-C SDK](https://github.com/facebook/facebook-objc-sdk) instead. 8 | * There is confusion about the nature of the Swift SDK itself and no clear benefit to using it over the Objective-C version. 9 | * Any updates to the Objective-C SDK have to keep in mind that many of its users are coding in Swift. 10 | 11 | #### Requirements 12 | Keeping these facts in mind, we set out to design a strategy for modernizing that adheres to several broad requirements. 13 | 14 | * Must be able to add Swift specific interfaces (this is achieved by having the Swift SDK wrap existing classes) 15 | * Must deprecate Objective-C interfaces for Swift users when adding new Swift interfaces 16 | * Must only deprecate Objective-C interfaces for Swift users. Objective-C users must not see deprecation warnings 17 | * Additive changes should be added to both SDKs when they are not constrained by language 18 | * Additions should be tested so that they offer a quality benefit on top of whatever other benefits they give 19 | 20 | #### Goals for modernization 21 | 22 | The ultimate goal of the Swift SDK is to provide modernizations that cannot be achieved in Objective-C such as: 23 | 24 | * Adding support for fetching `Codable` objects from the Graph API 25 | * Adding `Combine` publishers to existing services 26 | * Adding type-safety and validation to common types 27 | * Adding SwiftUI components for `LoginButton` and other UI components 28 | 29 | **Note:** Open an issue on GitHub or a pull request modifying this list if there is something else you'd like to see. 30 | 31 | 32 | ## Simplified Example 33 | 34 | The pattern will be to add an interface that is specific to Swift while hiding the underlying Objective-C interface that it depends on. 35 | 36 | I will go into more detail but before that; a simplistic example. These would be the steps for wrapping method `x`: 37 | 38 | 1. In the Swift SDK, add method `wrapsX`. It will wrap method `x` imported from the Objective-C SDK. 39 | 2. In the Objective-C SDK add underscored prefix method `__x` that wraps method `x`. 40 | 3. In the Objective-C SDK, tag method `x` with the `FB_SWIFT_DEPRECATED` macro shown below. 41 | ``` 42 | #if __swift__ 43 | #define FB_SWIFT_DEPRECATED(message) __attribute__((deprecated(message))); 44 | #else 45 | #define FB_SWIFT_DEPRECATED(...) 46 | #endif 47 | ``` 48 | 3. In the Swift SDK, update method `wrapsX` to call `__x` 49 | 4. In the Objective-C SDK, replace the `FB_SWIFT_DEPRECATED` macro with the [`NS_REFINED_FOR_SWIFT`](https://developer.apple.com/documentation/swift/objective-c_and_c_code_customization/improving_objective-c_api_declarations_for_swift) macro. 50 | 5. In the Objective-C SDK, delete method `__x` as it will be provided by `NS_REFINED_FOR_SWIFT`. 51 | 52 | If that all made perfect sense to you then feel free to skip the detailed example below. 53 | 54 | ## Detailed Example 55 | 56 | Consider, for instance, a function in Objective-C that accepts a pointer to a user. 57 | 58 | `- (void)setUser:(User *)user;` 59 | 60 | This is inherently unsafe. Also, in our pretend example we'd like to use a `ValidUser` struct. How can we update our API to encourage developers to use a `ValidUser` instead of a pointer? 61 | 62 | First we go into the Objective-C SDK and add the `FB_SWIFT_DEPRECATED` macro. 63 | 64 | `- (void)setUser:(User *)user FB_SWIFT_DEPRECATED("This will be replaced by 'setValidUser(_:)'");` 65 | 66 | Now, if you try and use this method from Swift, you will get a warning. Good. 67 | 68 | We then wrap the original call like so: 69 | 70 | ``` 71 | /// Artificially 'refined'. ie. can be used from Swift prior to using `NS_REFINED_FOR_SWIFT` macro 72 | - (void)__setUser:(User *)user { 73 | [self setUser:user]; 74 | } 75 | ``` 76 | 77 | With this in place we can move our efforts to the Swift project and wrap the artificially refined version of the method: 78 | 79 | ``` 80 | func setValid(_ validUser: ValidUser) -> Void { 81 | // Any number of strategies can be employed here to implement a layer of validation 82 | // and type-safety. 83 | // This assumes that we can simply use data from our validated user to construct 84 | // an instance of the Objective-C User class. 85 | let user = User(name: validUser.name, age: validUser.age) 86 | 87 | // Utilizes the original Objective-C implementation. 88 | // The __ is a naming convention associated with NS_REFINED_FOR_SWIFT 89 | __setUser(user) 90 | } 91 | ``` 92 | 93 | Now this is better but not perfect. We are providing Swift developers with a safer way to set a `User` but we also expose the unsafe way. 94 | 95 | We can fix this by going back into the Objective-C project and changing `FB_SWIFT_DEPRECATED` to `NS_REFINED_FOR_SWIFT`. The compiler will force us to delete our temporary underscore-prefixed wrapping method, since `NS_REFINED_FOR_SWIFT` will automatically expose the original `setUser:` method as `__setUser(_:)` to Swift. 96 | 97 | Now Swift developers will only be able to set a `User` if they are able to create a `ValidUser` struct. 98 | 99 | A contrived example but the same strategy will work for implementing more advanced functionality like fetching codable objects, removing strings and dictionaries from various method calls, and more! 100 | 101 | ## FAQ 102 | 103 | ### For Swift Developers 104 | 105 | #### Q: This seems like a process for updating the Swift codebase itself, how does it affect me? 106 | - You will be able to continue to use methods declared in the Objective-C SDK from your Swift project until they are tagged with `NS_REFINED_FOR_SWIFT` at which point you will need to either change to the modern invocation or make a decision to call the underscore-prefixed version. 107 | 108 | #### Q: Will I need to update my call-sites? 109 | - Yes but not immediately. We plan on rolling out changes slowly and giving developers ample time to transition to the modern syntax. This will not happen overnight. 110 | 111 | #### Q: Can I continue to use the Objective-C SDK if I'm a Swift Developer? 112 | - Yes but over time you will see warnings and ultimately deprecations of methods called from the Objective-C SDK. 113 | 114 | #### Q: In the recent past there have been unexpected breaking changes to this project. Why? 115 | 116 | - Between v0.6.0 and v0.7.0 - see: [comparison](https://github.com/facebook/facebook-swift-sdk/compare/v0.6.0...v0.7.0) - we updated to point to version 5.0 of the ObjC SDK. This was a breaking change and we should have cut a major release to reflect that. 117 | 118 | Those changes constituted a major effort to enhance the usability of the Swift interface that's generated from the ObjC SDK but it was not communicated well in terms of this project. The changes are documented reasonably well in this changelog under the [5.0 release](https://github.com/facebook/facebook-objc-sdk/blob/master/CHANGELOG.md#500) of the [Objective-C SDK](https://github.com/facebook/facebook-objc-sdk). There will be no future updates to major versions of the Objective-C SDK without corresponding updates to the Swift SDK. This caused a lot of churn and we'd like to provide a better experience than that. 119 | 120 | ### For Objective-C Developers 121 | 122 | #### Q: Does this affect me? 123 | - No. Carry on. 124 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | # 3 | # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | # copy, modify, and distribute this software in source code or binary form for use 5 | # in connection with the web services and APIs provided by Facebook. 6 | # 7 | # As with any software that integrates with the Facebook platform, your use of 8 | # this software is subject to the Facebook Developer Principles and Policies 9 | # [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | # included in all copies or substantial portions of the software. 11 | # 12 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | require 'mkmf' 20 | require 'json' 21 | 22 | # Make FileUtils less verbose aka not log anything when running `mkdir_p` 23 | Rake::FileUtilsExt.verbose(false) 24 | 25 | WORKSPACE = 'FacebookSwift.xcworkspace' 26 | SCHEMES = [ 27 | 'FacebookCore', 28 | 'FacebookLogin', 29 | 'FacebookShare', 30 | ] 31 | 32 | DOCS_FOLDER = '.docs' 33 | JAZZY_CONFIG = '.jazzy.json' 34 | 35 | def which(cmd) 36 | exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] 37 | ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| 38 | exts.each { |ext| 39 | exe = File.join(path, "#{cmd}#{ext}") 40 | return exe if File.executable?(exe) && !File.directory?(exe) 41 | } 42 | end 43 | return nil 44 | end 45 | 46 | desc 'Generate API Reference' 47 | task :docs do 48 | unless which('sourcekitten') && which('jazzy') 49 | puts 'Can\'t find sourcekitten and jazzy in $PATH.' 50 | puts 'Install them with \'brew install sourcekitten\' and \'gem install jazzy\'.' 51 | exit 1 52 | end 53 | 54 | declarations = [] 55 | SCHEMES.each do |scheme| 56 | json_string = `sourcekitten doc -- -scheme #{scheme} -workspace #{WORKSPACE}` 57 | json = JSON.parse(json_string) 58 | 59 | json = json.map do |element| 60 | element.map do |key,value| 61 | value["key.substructure"] = value["key.substructure"].select do |element| 62 | element["key.name"] != "==(_:_:)" 63 | end 64 | [key, value] 65 | end.to_h 66 | end 67 | declarations.concat json 68 | end 69 | 70 | mkdir_p '.docs' 71 | 72 | sourcekit_file = File.join(DOCS_FOLDER, 'source.json') 73 | File.open(sourcekit_file, 'w') do |f| 74 | f.write(declarations.to_json) 75 | end 76 | 77 | `jazzy --config #{JAZZY_CONFIG} --sourcekitten-sourcefile #{sourcekit_file} --output #{DOCS_FOLDER}` 78 | end 79 | -------------------------------------------------------------------------------- /Resources/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 | $(FBSDK_SWIFT_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FBSDK_SWIFT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | # Facebook Swift SDK Support 2 | 3 | We're excited to offer this Swift SDK and we want to support you in your development. 4 | 5 | ## Documentation 6 | 7 | Before asking questions, please familiarize yourself with our [Docs](https://developers.facebook.com/docs/swift) and 8 | [Reference](https://developers.facebook.com/docs/swift/reference). 9 | 10 | ## Questions 11 | 12 | If you have a specific question regarding this SDK, make sure you check out 13 | [Stack Overflow](https://facebook.stackoverflow.com) and the 14 | [Facebook Developers Group](https://www.facebook.com/groups/fbdevelopers). 15 | 16 | ## GitHub Issues 17 | 18 | If you are running into issues with this SDK, including potential bugs or feature requests, we recommend filing a 19 | [GitHub Issue](https://github.com/facebook/facebook-swift-sdk/issues). Please check out our 20 | [Contributing Guidelines](CONTRIBUTING.md). 21 | -------------------------------------------------------------------------------- /Samples/Catalog/Configurations/Shared: -------------------------------------------------------------------------------- 1 | ../../../Configurations/Shared -------------------------------------------------------------------------------- /Samples/Catalog/Configurations/SwiftCatalog.xcconfig: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #include "Shared/Platform/iOS.xcconfig" 20 | #include "Shared/Product/Application.xcconfig" 21 | 22 | PRODUCT_NAME = SwiftCatalog 23 | PRODUCT_BUNDLE_IDENTIFIER = com.facebook.SwiftCatalog 24 | 25 | CODE_SIGN_IDENTITY = iPhone Developer 26 | CODE_SIGN_ENTITLEMENTS = Resources/SwiftCatalog.entitlements 27 | 28 | SWIFT_VERSION = 4.0 29 | 30 | IPHONEOS_DEPLOYMENT_TARGET = 8.0 31 | 32 | INFOPLIST_FILE = $(SRCROOT)/Resources/Info.plist 33 | -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppEventsIcon.imageset/AppEventsIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppEventsIcon.imageset/AppEventsIcon.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppEventsIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "AppEventsIcon.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-Small.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-Small@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-Small@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "57x57", 47 | "idiom" : "iphone", 48 | "filename" : "Icon.png", 49 | "scale" : "1x" 50 | }, 51 | { 52 | "size" : "57x57", 53 | "idiom" : "iphone", 54 | "filename" : "Icon@2x.png", 55 | "scale" : "2x" 56 | }, 57 | { 58 | "size" : "60x60", 59 | "idiom" : "iphone", 60 | "filename" : "Icon-60@2x.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "60x60", 65 | "idiom" : "iphone", 66 | "filename" : "Icon-60@3x.png", 67 | "scale" : "3x" 68 | }, 69 | { 70 | "size" : "20x20", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-20.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "20x20", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-20@2x-1.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "29x29", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-Small.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "29x29", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-Small@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "40x40", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-40.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "40x40", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-40@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "50x50", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-Small-50.png", 109 | "scale" : "1x" 110 | }, 111 | { 112 | "size" : "50x50", 113 | "idiom" : "ipad", 114 | "filename" : "Icon-Small-50@2x.png", 115 | "scale" : "2x" 116 | }, 117 | { 118 | "size" : "72x72", 119 | "idiom" : "ipad", 120 | "filename" : "Icon-72.png", 121 | "scale" : "1x" 122 | }, 123 | { 124 | "size" : "72x72", 125 | "idiom" : "ipad", 126 | "filename" : "Icon-72@2x.png", 127 | "scale" : "2x" 128 | }, 129 | { 130 | "size" : "76x76", 131 | "idiom" : "ipad", 132 | "filename" : "Icon-76.png", 133 | "scale" : "1x" 134 | }, 135 | { 136 | "size" : "76x76", 137 | "idiom" : "ipad", 138 | "filename" : "Icon-76@2x.png", 139 | "scale" : "2x" 140 | }, 141 | { 142 | "size" : "83.5x83.5", 143 | "idiom" : "ipad", 144 | "filename" : "Icon-83.5@2x.png", 145 | "scale" : "2x" 146 | }, 147 | { 148 | "size" : "1024x1024", 149 | "idiom" : "ios-marketing", 150 | "filename" : "Icon-1024.png", 151 | "scale" : "1x" 152 | } 153 | ], 154 | "info" : { 155 | "version" : 1, 156 | "author" : "xcode" 157 | } 158 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-1024.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-20.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-20@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-20@2x-1.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-20@2x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-20@3x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-40.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-72.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-72@2x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-76.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small-50.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppIcon.appiconset/Icon@2x.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppInvitesIcon.imageset/AppInvitesIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppInvitesIcon.imageset/AppInvitesIcon.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppInvitesIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "AppInvitesIcon.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppLinksIcon.imageset/AppLinksIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/AppLinksIcon.imageset/AppLinksIcon.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/AppLinksIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "AppLinksIcon.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/GraphAPIIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "GraphAPIIcon.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/GraphAPIIcon.imageset/GraphAPIIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/GraphAPIIcon.imageset/GraphAPIIcon.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/1024x768.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/1024x768.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/1242x2208.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/1242x2208.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/1536x2048.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/1536x2048.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/2048x1536.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/2048x1536.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/2208x1242.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/2208x1242.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/640x1136.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/640x1136.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/640x960.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/640x960.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/750x1334.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/750x1334.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/768x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/768x1024.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "736h", 7 | "filename" : "1242x2208.png", 8 | "minimum-system-version" : "8.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "736h", 16 | "filename" : "2208x1242.png", 17 | "minimum-system-version" : "8.0", 18 | "orientation" : "landscape", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "extent" : "full-screen", 23 | "idiom" : "iphone", 24 | "subtype" : "667h", 25 | "filename" : "750x1334.png", 26 | "minimum-system-version" : "8.0", 27 | "orientation" : "portrait", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "filename" : "640x960.png", 34 | "extent" : "full-screen", 35 | "minimum-system-version" : "7.0", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "extent" : "full-screen", 40 | "idiom" : "iphone", 41 | "subtype" : "retina4", 42 | "filename" : "640x1136.png", 43 | "minimum-system-version" : "7.0", 44 | "orientation" : "portrait", 45 | "scale" : "2x" 46 | }, 47 | { 48 | "orientation" : "portrait", 49 | "idiom" : "ipad", 50 | "filename" : "768x1024.png", 51 | "extent" : "full-screen", 52 | "minimum-system-version" : "7.0", 53 | "scale" : "1x" 54 | }, 55 | { 56 | "orientation" : "landscape", 57 | "idiom" : "ipad", 58 | "filename" : "1024x768.png", 59 | "extent" : "full-screen", 60 | "minimum-system-version" : "7.0", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "orientation" : "portrait", 65 | "idiom" : "ipad", 66 | "filename" : "1536x2048.png", 67 | "extent" : "full-screen", 68 | "minimum-system-version" : "7.0", 69 | "scale" : "2x" 70 | }, 71 | { 72 | "orientation" : "landscape", 73 | "idiom" : "ipad", 74 | "filename" : "2048x1536.png", 75 | "extent" : "full-screen", 76 | "minimum-system-version" : "7.0", 77 | "scale" : "2x" 78 | } 79 | ], 80 | "info" : { 81 | "version" : 1, 82 | "author" : "xcode" 83 | } 84 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LoginIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LoginIcon.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/LoginIcon.imageset/LoginIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/LoginIcon.imageset/LoginIcon.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/ShareIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ShareIcon.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/ShareIcon.imageset/ShareIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/ShareIcon.imageset/ShareIcon.png -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/sky.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "sky.mp4" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/sky.dataset/sky.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/sky.dataset/sky.mp4 -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/sky.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "sky.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Assets.xcassets/sky.imageset/sky.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/facebook-swift-sdk/f347bb5f03527aec32d290164b88c7c3bfa928bf/Samples/Catalog/Resources/Assets.xcassets/sky.imageset/sky.jpg -------------------------------------------------------------------------------- /Samples/Catalog/Resources/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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Samples/Catalog/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | FBSDKCatalog 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleURLTypes 24 | 25 | 26 | CFBundleURLSchemes 27 | 28 | catalogApp 29 | 30 | 31 | 32 | CFBundleURLSchemes 33 | 34 | fb1532460837044551 35 | 36 | 37 | 38 | CFBundleVersion 39 | 1 40 | FacebookAppID 41 | 1532460837044551 42 | FacebookDisplayName 43 | Catalog 44 | LSApplicationQueriesSchemes 45 | 46 | fbapi 47 | fb-messenger-api 48 | fbauth2 49 | fbshareextension 50 | 51 | LSRequiresIPhoneOS 52 | 53 | NSMainStoryboardFile 54 | Main 55 | NSPhotoLibraryUsageDescription 56 | Share content from Photo Library on Facebook. 57 | UILaunchStoryboardName 58 | LaunchScreen 59 | UIMainStoryboardFile 60 | Main 61 | UIRequiredDeviceCapabilities 62 | 63 | armv7 64 | 65 | UISupportedInterfaceOrientations 66 | 67 | UIInterfaceOrientationPortrait 68 | UIInterfaceOrientationLandscapeLeft 69 | UIInterfaceOrientationLandscapeRight 70 | UIInterfaceOrientationPortraitUpsideDown 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Samples/Catalog/Resources/SwiftCatalog.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | keychain-access-groups 6 | 7 | $(AppIdentifierPrefix)com.facebook.SwiftCatalog 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import Foundation 20 | import UIKit 21 | 22 | import FacebookCore 23 | 24 | @UIApplicationMain 25 | final class AppDelegate: UIResponder, UIApplicationDelegate { 26 | var window: UIWindow? 27 | 28 | // MARK: UIApplicationDelegate 29 | 30 | func application(_ application: UIApplication, 31 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 32 | 33 | ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions) 34 | 35 | return true 36 | } 37 | 38 | func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { 39 | return ApplicationDelegate.shared.application( 40 | application, 41 | open: url, 42 | sourceApplication: sourceApplication, 43 | annotation: annotation 44 | ) 45 | } 46 | 47 | @available(iOS 9.0, *) 48 | func application(_ application: UIApplication, 49 | open url: URL, 50 | options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool { 51 | return ApplicationDelegate.shared.application(application, open: url, options: options) 52 | } 53 | 54 | func applicationDidBecomeActive(_ application: UIApplication) { 55 | AppEvents.activateApp() 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/AppInviteViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import UIKit 20 | 21 | import FacebookShare 22 | import FBSDKCoreKit 23 | import FBSDKShareKit 24 | 25 | final class AppInviteViewController: UITableViewController { 26 | func showAppInviteDialog(for appInvite: AppInviteContent) { 27 | // do { 28 | // try AppInvite.Dialog.show(from: self, invite: appInvite) { result in 29 | // switch result { 30 | // case .success(let result): 31 | // print("App Invite Sent with result \(result)") 32 | // case .failed(let error): 33 | // print("Failed to send app invite with error \(error)") 34 | // } 35 | // } 36 | // } catch { 37 | // print("Failed to show app invite dialog with error \(error)") 38 | // } 39 | } 40 | 41 | @IBAction private func appInviteWithDefaultImage() { 42 | // // Facebook hosted App Link is used here. See https://developers.facebook.com/docs/applinks for details. 43 | // guard let appLink = URL(string: "https://fb.me/1539184863038815") else { return } 44 | // let appInvite = AppInviteContent(appLink: appLink, deliveryMethod: .facebook) 45 | // showAppInviteDialog(for: appInvite) 46 | } 47 | 48 | @IBAction private func appInviteWithCustomImage() { 49 | // // Facebook hosted App Link is used here. See https://developers.facebook.com/docs/applinks for details. 50 | // guard let appLink = URL(string: "https://fb.me/1539184863038815") else { return } 51 | // let previewImageURL = URL(string: "http://catalogapp.parseapp.com/FacebookDeveloper.jpg") 52 | // let appInvite = AppInviteContent( 53 | // appLink: appLink, 54 | // deliveryMethod: .facebook, 55 | // previewImageURL: previewImageURL 56 | // ) 57 | // showAppInviteDialog(for: appInvite) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/CustomAppEventViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import FacebookCore 20 | import Foundation 21 | import UIKit 22 | 23 | final class CustomAppEventViewController: UIViewController { 24 | @IBOutlet private(set) var eventNameField: UITextField? 25 | 26 | //-------------------------------------- 27 | // MARK: - Log Custom Event 28 | //-------------------------------------- 29 | 30 | @IBAction private func logCustomEvent() { 31 | guard let eventName = eventNameField?.text else { 32 | let alertController = UIAlertController(title: "Invalid Event", message: "Event name can't be empty.") 33 | present(alertController, animated: true, completion: nil) 34 | return 35 | } 36 | 37 | AppEvents.logEvent(AppEvents.Name(eventName)) 38 | 39 | // View your event at https://developers.facebook.com/analytics/. 40 | // See https://developers.facebook.com/docs/analytics for details. 41 | 42 | let alertController = UIAlertController(title: "Log Event", message: "Log Event Success") 43 | present(alertController, animated: true, completion: nil) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/GraphAPIPostViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import FacebookCore 20 | import Foundation 21 | import UIKit 22 | 23 | class GraphAPIPostViewController: UITableViewController { 24 | 25 | //-------------------------------------- 26 | // MARK: - Post Checkin 27 | //-------------------------------------- 28 | 29 | /** 30 | Posts a check-in to your feed. 31 | 32 | See https://developers.facebook.com/docs/graph-api/reference/user/feed for details. 33 | Place is hardcoded here, see https://developers.facebook.com/docs/graph-api/using-graph-api/#search 34 | for building a place picker. 35 | */ 36 | @IBAction private func postCheckin() { 37 | let request = GraphRequest(graphPath: "/me/feed", 38 | parameters: [ "message": "Here I am!", "place": "141887372509674" ], 39 | httpMethod: .post) 40 | request.start { [weak self] _, result, error in 41 | 42 | let alertController: UIAlertController 43 | 44 | switch (result, error) { 45 | case let (result?, nil): 46 | print("Graph Request Succeeded: \(result)") 47 | alertController = UIAlertController(title: "Graph Request Success", 48 | message: "Graph Request Succeeded with result: \(result)") 49 | self?.present(alertController, animated: true, completion: nil) 50 | case let (nil, error?): 51 | print("Graph Request Failed: \(error)") 52 | alertController = UIAlertController(title: "Graph Request Failed", 53 | message: "Graph Request Failed with error: \(error)") 54 | self?.present(alertController, animated: true, completion: nil) 55 | case (_, _): 56 | print("Graph Request Failed: unknown error") 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/GraphAPIReadViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import Foundation 20 | import UIKit 21 | 22 | import FacebookCore 23 | 24 | class GraphAPIReadViewController: UITableViewController { 25 | 26 | func presentAlertController(result: Any?, error: Error?) { 27 | let alertController: UIAlertController 28 | 29 | switch (result, error) { 30 | case let (result?, nil): 31 | print("Graph Request Succeeded: \(result)") 32 | alertController = UIAlertController(title: "Graph Request Success", 33 | message: "Graph Request Succeeded with result: \(result)") 34 | present(alertController, animated: true, completion: nil) 35 | case let (nil, error?): 36 | print("Graph Request Failed: \(error)") 37 | alertController = UIAlertController(title: "Graph Request Failed", 38 | message: "Graph Request Failed with error: \(error)") 39 | present(alertController, animated: true, completion: nil) 40 | case (_, _): 41 | print("Graph Request Failed: unknown error") 42 | } 43 | } 44 | 45 | //-------------------------------------- 46 | // MARK: - Read Profile 47 | //-------------------------------------- 48 | 49 | /** 50 | Fetches the currently logged in user's public profile. 51 | Uses a custom type for profile request. 52 | 53 | See https://developers.facebook.com/docs/graph-api/reference/user/ for details. 54 | */ 55 | @IBAction private func readProfile() { 56 | let request = GraphRequest(graphPath: "/me", 57 | parameters: ["fields": "id, name"], 58 | httpMethod: .get) 59 | request.start { [weak self] _, result, error in 60 | self?.presentAlertController(result: result, error: error) 61 | } 62 | } 63 | 64 | //-------------------------------------- 65 | // MARK: - Read User Events 66 | //-------------------------------------- 67 | 68 | /** 69 | Fetches the currently logged in user's list of events. 70 | */ 71 | @IBAction private func readUserEvents() { 72 | let request = GraphRequest(graphPath: "/me/events", 73 | parameters: [ "fields": "data, description" ], 74 | httpMethod: .get) 75 | request.start { [weak self] _, result, error in 76 | self?.presentAlertController(result: result, error: error) 77 | } 78 | } 79 | 80 | //-------------------------------------- 81 | // MARK: - Read User Friend List 82 | //-------------------------------------- 83 | 84 | /** 85 | Fetches the currently logged in user's list of facebook friends. 86 | */ 87 | @IBAction private func readUserFriendList() { 88 | let request = GraphRequest(graphPath: "/me/friends", 89 | parameters: [ "fields": "data" ], 90 | httpMethod: .get) 91 | request.start { [weak self] _, result, error in 92 | self?.presentAlertController(result: result, error: error) 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/LoginButtonViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import FacebookLogin 20 | import Foundation 21 | import UIKit 22 | 23 | class LoginButtonViewController: UIViewController, LoginButtonDelegate { 24 | 25 | override func viewDidLoad() { 26 | super.viewDidLoad() 27 | let button = FBLoginButton(permissions: [.publicProfile]) 28 | button.delegate = self 29 | button.center = view.center 30 | view.addSubview(button) 31 | } 32 | 33 | // MARK: LoginButtonDelegate 34 | 35 | func loginButton(_ loginButton: FBLoginButton, didCompleteWith result: LoginManagerLoginResult?, error: Error?) { 36 | print("Did complete login via LoginButton with result \(String(describing: result)) " + 37 | "error\(String(describing: error))") 38 | } 39 | 40 | func loginButtonDidLogOut(_ loginButton: FBLoginButton) { 41 | print("Did logout via LoginButton") 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/LoginManagerViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import Foundation 20 | import UIKit 21 | 22 | import FacebookCore 23 | import FacebookLogin 24 | 25 | class LoginManagerViewController: UIViewController { 26 | 27 | func loginManagerDidComplete(_ result: LoginResult) { 28 | let alertController: UIAlertController 29 | switch result { 30 | case .cancelled: 31 | alertController = UIAlertController(title: "Login Cancelled", message: "User cancelled login.") 32 | case .failed(let error): 33 | alertController = UIAlertController(title: "Login Fail", message: "Login failed with error \(error)") 34 | case .success(let grantedPermissions, _, _): 35 | alertController = UIAlertController(title: "Login Success", 36 | message: "Login succeeded with granted permissions: \(grantedPermissions)") 37 | } 38 | self.present(alertController, animated: true, completion: nil) 39 | } 40 | 41 | @IBAction private func loginWithReadPermissions() { 42 | let loginManager = LoginManager() 43 | loginManager.logIn(permissions: [.publicProfile, .userFriends], viewController: self) { result in 44 | self.loginManagerDidComplete(result) 45 | } 46 | } 47 | 48 | @IBAction private func logOut() { 49 | let loginManager = LoginManager() 50 | loginManager.logOut() 51 | 52 | let alertController = UIAlertController(title: "Logout", message: "Logged out.") 53 | present(alertController, animated: true, completion: nil) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/MainCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import UIKit 20 | 21 | final class MainCollectionViewCell: UICollectionViewCell { 22 | @IBOutlet private(set) var textLabel: UILabel? 23 | @IBOutlet private(set) var iconImageView: UIImageView? 24 | 25 | func updateFrom(_ item: MainCollectionViewController.Item) { 26 | textLabel?.text = item.text 27 | iconImageView?.image = item.image 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/MainCollectionViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import Foundation 20 | import UIKit 21 | 22 | final class MainCollectionViewController: UICollectionViewController { 23 | private let iconArray: [Item] = [ 24 | Item(text: "Login", iconImageName: "LoginIcon"), 25 | Item(text: "Share", iconImageName: "ShareIcon"), 26 | Item(text: "App Events", iconImageName: "AppEventsIcon"), 27 | Item(text: "App Invites", iconImageName: "AppInvitesIcon"), 28 | Item(text: "Graph API", iconImageName: "GraphAPIIcon") 29 | ] 30 | 31 | override func viewWillAppear(_ animated: Bool) { 32 | super.viewWillAppear(animated) 33 | navigationController?.navigationBar.isHidden = true 34 | } 35 | 36 | override func viewWillDisappear(_ animated: Bool) { 37 | super.viewWillDisappear(animated) 38 | navigationController?.navigationBar.isHidden = false 39 | } 40 | 41 | //-------------------------------------- 42 | // MARK: - UICollectionViewDataSource 43 | //-------------------------------------- 44 | 45 | override func numberOfSections(in collectionView: UICollectionView) -> Int { 46 | return 1 47 | } 48 | 49 | override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 50 | return iconArray.count 51 | } 52 | 53 | override func collectionView(_ collectionView: UICollectionView, 54 | cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 55 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) 56 | if let menuCell = cell as? MainCollectionViewCell { 57 | menuCell.updateFrom(iconArray[(indexPath as NSIndexPath).row]) 58 | } else { 59 | fatalError("CollectionView provided wrong cell for indexPath \(indexPath)") 60 | } 61 | return cell 62 | } 63 | 64 | //-------------------------------------- 65 | // MARK: - UICollectionViewDelegate 66 | //-------------------------------------- 67 | 68 | override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 69 | performSegue(withIdentifier: iconArray[(indexPath as NSIndexPath).row].text, sender: self) 70 | } 71 | 72 | //-------------------------------------- 73 | // MARK: - Types 74 | //-------------------------------------- 75 | 76 | struct Item { 77 | var text: String 78 | var iconImageName: String 79 | 80 | var image: UIImage? { 81 | return UIImage(named: iconImageName) 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/ManualAppEventViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import FacebookCore 20 | import UIKit 21 | 22 | final class ManualAppEventViewController: UITableViewController { 23 | @IBOutlet private(set) var purchasePriceField: UITextField? 24 | @IBOutlet private(set) var purchaseCurrencyField: UITextField? 25 | @IBOutlet private(set) var itemPriceField: UITextField? 26 | @IBOutlet private(set) var itemCurrencyField: UITextField? 27 | 28 | //-------------------------------------- 29 | // MARK: - Log Purchase 30 | //-------------------------------------- 31 | 32 | @IBAction private func logPurchase() { 33 | guard 34 | let priceString = purchasePriceField?.text, 35 | let price = Double(priceString) else { 36 | let alertController = UIAlertController(title: "Invalid Purchase Price", 37 | message: "Purchase price must be a valid number.") 38 | present(alertController, animated: true, completion: nil) 39 | return 40 | } 41 | guard let currency = purchaseCurrencyField?.text else { 42 | let alertController = UIAlertController(title: "Invalid currency", message: "Currency cannot be empty.") 43 | present(alertController, animated: true, completion: nil) 44 | return 45 | } 46 | 47 | AppEvents.logPurchase(price, currency: currency) 48 | // View your event at https://developers.facebook.com/analytics/. 49 | // See https://developers.facebook.com/docs/analytics for details. 50 | 51 | let alertController = UIAlertController(title: "Log Event", message: "Log Event Success") 52 | present(alertController, animated: true, completion: nil) 53 | } 54 | 55 | //-------------------------------------- 56 | // MARK: - Log Add To Cart 57 | //-------------------------------------- 58 | 59 | @IBAction private func logAddToCart() { 60 | guard 61 | let priceString = itemPriceField?.text, 62 | let price = Double(priceString) else { 63 | let alertController = UIAlertController(title: "Invalid Item Price", 64 | message: "Item price must be a valid number.") 65 | present(alertController, animated: true, completion: nil) 66 | return 67 | } 68 | guard let currency = itemCurrencyField?.text else { 69 | let alertController = UIAlertController(title: "Invalid currency", message: "Currency cannot be empty.") 70 | present(alertController, animated: true, completion: nil) 71 | return 72 | } 73 | 74 | let parameters: [String: String] = [AppEvents.ParameterName.currency.rawValue: currency] 75 | AppEvents.logEvent(.addedToCart, valueToSum: price, parameters: parameters) 76 | 77 | let alertController = UIAlertController(title: "Log Event", message: "Log Event Success") 78 | present(alertController, animated: true, completion: nil) 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/ShareAPIViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import UIKit 20 | 21 | import FacebookShare 22 | 23 | final class ShareAPIViewController: UITableViewController, SharingDelegate { 24 | 25 | //-------------------------------------- 26 | // MARK: - Link Content 27 | //-------------------------------------- 28 | 29 | @IBAction private func shareLink() { 30 | guard let url = URL(string: "https://newsroom.fb.com/") else { return } 31 | let content = ShareLinkContent() 32 | content.contentURL = url 33 | ShareAPI(content: content, delegate: self).share() 34 | } 35 | 36 | //-------------------------------------- 37 | // MARK: - Photo Content 38 | //-------------------------------------- 39 | 40 | @IBAction private func sharePhoto() { 41 | let content = SharePhotoContent() 42 | content.photos = [SharePhoto(image: #imageLiteral(resourceName: "sky"), userGenerated: true)] 43 | ShareAPI(content: content, delegate: self).share() 44 | } 45 | 46 | //-------------------------------------- 47 | // MARK: - Video Content 48 | //-------------------------------------- 49 | 50 | @IBAction private func shareVideo() { 51 | guard let url = Bundle.main.url(forResource: "sky", withExtension: "mp4") else { return } 52 | let content = ShareVideoContent() 53 | content.video = ShareVideo(videoURL: url) 54 | ShareAPI(content: content, delegate: self).share() 55 | } 56 | 57 | func sharer(_ sharer: Sharing, didCompleteWithResults results: [String: Any]) { 58 | let title = "Share Success" 59 | let message = "Succesfully shared: \(results)" 60 | let alertController = UIAlertController(title: title, message: message) 61 | self.present(alertController, animated: true, completion: nil) 62 | } 63 | 64 | func sharer(_ sharer: Sharing, didFailWithError error: Error) { 65 | let title = "Share Failed" 66 | let message = "Sharing failed with error \(error)" 67 | let alertController = UIAlertController(title: title, message: message) 68 | self.present(alertController, animated: true, completion: nil) 69 | } 70 | 71 | func sharerDidCancel(_ sharer: Sharing) { 72 | let title = "Share Cancelled" 73 | let message = "Sharing was cancelled by user." 74 | let alertController = UIAlertController(title: title, message: message) 75 | self.present(alertController, animated: true, completion: nil) 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/ShareDialogViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import MobileCoreServices 20 | import UIKit 21 | 22 | import FacebookShare 23 | 24 | final class ShareDialogViewController: UITableViewController, 25 | UIImagePickerControllerDelegate, 26 | UINavigationControllerDelegate, 27 | SharingDelegate { 28 | 29 | func showShareDialog(_ content: C, mode: ShareDialog.Mode = .automatic) { 30 | let dialog = ShareDialog(fromViewController: self, content: content, delegate: self) 31 | dialog.mode = mode 32 | dialog.show() 33 | } 34 | 35 | //-------------------------------------- 36 | // MARK: - Link Content 37 | //-------------------------------------- 38 | 39 | @IBAction private func showLinkShareDialogModeAutomatic() { 40 | guard let url = URL(string: "https://newsroom.fb.com/") else { return } 41 | let content = ShareLinkContent() 42 | content.contentURL = url 43 | 44 | // placeId is hardcoded here, see https://developers.facebook.com/docs/graph-api/using-graph-api/#search 45 | // for building a place picker. 46 | content.placeID = "166793820034304" 47 | 48 | showShareDialog(content, mode: .automatic) 49 | } 50 | 51 | @IBAction private func showLinkShareDialogModeWeb() { 52 | guard let url = URL(string: "https://newsroom.fb.com/") else { return } 53 | let content = ShareLinkContent() 54 | content.contentURL = url 55 | 56 | // placeId is hardcoded here, see https://developers.facebook.com/docs/graph-api/using-graph-api/#search 57 | // for building a place picker. 58 | content.placeID = "166793820034304" 59 | 60 | showShareDialog(content, mode: .web) 61 | } 62 | 63 | //-------------------------------------- 64 | // MARK: - Photo Content 65 | //-------------------------------------- 66 | 67 | @IBAction private func showShareDialogPhotoContent() { 68 | let content = SharePhotoContent() 69 | content.photos = [SharePhoto(image: #imageLiteral(resourceName: "sky"), userGenerated: true)] 70 | showShareDialog(content) 71 | } 72 | 73 | //-------------------------------------- 74 | // MARK: - Video Content 75 | //-------------------------------------- 76 | 77 | @IBAction private func showShareDialogVideoContent() { 78 | let imagePickerController = UIImagePickerController() 79 | imagePickerController.delegate = self 80 | imagePickerController.sourceType = .photoLibrary 81 | imagePickerController.mediaTypes = [kUTTypeMovie as String] 82 | present(imagePickerController, animated: true, completion: nil) 83 | } 84 | 85 | // MARK: UIImagePickerControllerDelegate 86 | 87 | func imagePickerController(_ picker: UIImagePickerController, 88 | didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) { 89 | picker.dismiss(animated: true, completion: nil) 90 | 91 | guard let videoURL = info[.referenceURL] as? URL else { 92 | return 93 | } 94 | 95 | let content = ShareVideoContent() 96 | content.video = ShareVideo(videoURL: videoURL) 97 | showShareDialog(content) 98 | } 99 | 100 | func sharer(_ sharer: Sharing, didCompleteWithResults results: [String: Any]) { 101 | let title = "Share Success" 102 | let message = "Succesfully shared: \(results)" 103 | let alertController = UIAlertController(title: title, message: message) 104 | self.present(alertController, animated: true, completion: nil) 105 | } 106 | 107 | func sharer(_ sharer: Sharing, didFailWithError error: Error) { 108 | let title = "Share Failed" 109 | let message = "Sharing failed with error \(error)" 110 | let alertController = UIAlertController(title: title, message: message) 111 | self.present(alertController, animated: true, completion: nil) 112 | } 113 | 114 | func sharerDidCancel(_ sharer: Sharing) { 115 | let title = "Share Cancelled" 116 | let message = "Sharing was cancelled by user." 117 | let alertController = UIAlertController(title: title, message: message) 118 | self.present(alertController, animated: true, completion: nil) 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /Samples/Catalog/Sources/UIAlertController+Extensions.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import Foundation 20 | import UIKit 21 | 22 | public extension UIAlertAction { 23 | /// Action types most commonly used 24 | enum ActionType { 25 | ///Ok Option 26 | case ok 27 | /// Default Cancel Option 28 | case cancel 29 | /// Destructive action with custom title 30 | case destructive(String) 31 | /// Custom action with title and style 32 | case custom(String, UIAlertAction.Style) 33 | 34 | /** 35 | Creates the action instance for UIAlertController 36 | 37 | - parameter handler: Call Back function 38 | - returns UIAlertAction Instance 39 | */ 40 | public func action(handler: ((String) -> Void)? = nil) -> UIAlertAction { 41 | //Default value 42 | var actionStyle: UIAlertAction.Style = .default 43 | var title = "" 44 | // Action configuration based on the action type 45 | switch self { 46 | 47 | case .cancel: 48 | actionStyle = .cancel 49 | title = "Cancel" 50 | 51 | case .destructive(let optionTitle): 52 | title = optionTitle 53 | actionStyle = .destructive 54 | 55 | case let .custom(optionTitle, style): 56 | title = optionTitle 57 | actionStyle = style 58 | 59 | default: 60 | title = "OK" 61 | } 62 | //Creating UIAlertAction instance 63 | return UIAlertAction(title: title, style: actionStyle) { _ in 64 | if let handler = handler { 65 | handler(title) 66 | } 67 | } 68 | 69 | } 70 | } 71 | } 72 | 73 | extension UIAlertController { 74 | /** 75 | Creates the alert view controller using the actions specified, including an "OK" Action 76 | 77 | - parameter title: Title of the alert. 78 | - parameter message: Alert message body. 79 | - parameter style: UIAlertControllerStyle enum value 80 | - parameter handler: Handler block/closure for the clicked option. 81 | */ 82 | convenience init(title: String, 83 | message: String, 84 | style: UIAlertController.Style = .alert, 85 | handler: ((String) -> Swift.Void)? = nil) { 86 | //initialize the contoller (self) instance 87 | self.init(title: title, message: message, preferredStyle: style) 88 | 89 | if actions.isEmpty { 90 | addAction(UIAlertAction.ActionType.ok.action(handler: handler)) 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Samples/Catalog/SwiftCatalog.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Samples/Catalog/SwiftCatalog.xcodeproj/xcshareddata/xcschemes/SwiftCatalog.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Sources/Core/AccessToken.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import Foundation 20 | 21 | /** 22 | AccessToken Extension 23 | */ 24 | public extension AccessToken { 25 | /** 26 | Returns the known granted permissions. 27 | */ 28 | var permissions: Set { 29 | return Set(__permissions.map { Permission(stringLiteral: $0) }) 30 | } 31 | 32 | /** 33 | Returns the known declined permissions. 34 | */ 35 | var declinedPermissions: Set { 36 | return Set(__declinedPermissions.map { Permission(stringLiteral: $0) }) 37 | } 38 | 39 | /** 40 | Returns the known expired permissions. 41 | */ 42 | var expiredPermissions: Set { 43 | return Set(__expiredPermissions.map { Permission(stringLiteral: $0) }) 44 | } 45 | 46 | /** 47 | Convenience getter to determine if a permission has been granted 48 | - parameter permission: The permission to check 49 | */ 50 | func hasGranted(_ permission: Permission) -> Bool { 51 | return hasGranted(permission: permission.name) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Sources/Core/Dictionary+KeyValueMap.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | internal extension Dictionary { 20 | func mapKeyValues(_ transform: (Element) throws -> (K, V)) rethrows -> [K: V] { 21 | var dictionary: [K: V] = [:] 22 | try forEach { 23 | let transformed = try transform($0) 24 | dictionary[transformed.0] = transformed.1 25 | } 26 | return dictionary 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sources/Core/FBProfilePictureView.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import Foundation 20 | import UIKit 21 | 22 | /** 23 | FBProfilePictureView Extension 24 | */ 25 | public extension FBProfilePictureView { 26 | /** 27 | Create a new instance of `UserProfilePictureView`. 28 | 29 | - Parameter frame: Optional frame rectangle for the view, measured in points. 30 | - Parameter profile: Optional profile to display a picture for. Default: `UserProfile.current`. 31 | */ 32 | convenience init(frame: CGRect = .zero, profile: Profile? = nil) { 33 | self.init(frame: frame) 34 | 35 | if let profile = profile { 36 | profileID = profile.userID 37 | } 38 | 39 | autoresizingMask = [.flexibleWidth, .flexibleHeight] 40 | setNeedsImageUpdate() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Sources/Core/FBSDKCoreKit+Typealiases.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import FBSDKCoreKit 20 | import Foundation 21 | 22 | // Typealiases for FBSDKCoreKit types to avoid having to import 23 | // dependent libraries. At somepoint these will be likely 24 | // become "wrapper" types that extend and enhance functionality 25 | // in addition to exposing it. For now it suffices to simply expose 26 | // them to the correct library aka. FacebookCore 27 | 28 | /** 29 | Wrapper for `FBSDKCoreKit.AccessToken` 30 | 31 | - SeeAlso: `FBSDKCoreKit.AccessToken` 32 | */ 33 | public typealias AccessToken = FBSDKCoreKit.AccessToken 34 | 35 | /** 36 | Wrapper for `FBSDKCoreKit.AppEvents` 37 | 38 | - SeeAlso: `FBSDKCoreKit.AppEvents` 39 | */ 40 | public typealias AppEvents = FBSDKCoreKit.AppEvents 41 | 42 | /** 43 | Wrapper for `FBSDKCoreKit.AppLink` 44 | 45 | - SeeAlso: `FBSDKCoreKit.AppLink` 46 | */ 47 | public typealias AppLink = FBSDKCoreKit.AppLink 48 | 49 | /** 50 | Wrapper for `FBSDKCoreKit.AppLinkNavigation` 51 | 52 | - SeeAlso: `FBSDKCoreKit.AppLinkNavigation` 53 | */ 54 | public typealias AppLinkNavigation = FBSDKCoreKit.AppLinkNavigation 55 | 56 | /** 57 | Wrapper for `FBSDKCoreKit.AppLinkResolver` 58 | 59 | - SeeAlso: `FBSDKCoreKit.AppLinkResolver` 60 | */ 61 | public typealias AppLinkResolver = FBSDKCoreKit.AppLinkResolver 62 | 63 | /** 64 | Wrapper for `FBSDKCoreKit.AppLinkReturnToRefererController` 65 | 66 | - SeeAlso: `FBSDKCoreKit.AppLinkReturnToRefererController` 67 | */ 68 | public typealias AppLinkReturnToRefererController = FBSDKCoreKit.AppLinkReturnToRefererController 69 | 70 | /** 71 | Wrapper for `FBSDKCoreKit.AppLinkTarget` 72 | 73 | - SeeAlso: `FBSDKCoreKit.AppLinkTarget` 74 | */ 75 | public typealias AppLinkTarget = FBSDKCoreKit.AppLinkTarget 76 | 77 | /** 78 | Wrapper for `FBSDKCoreKit.AppLinkURL` 79 | 80 | - SeeAlso: `FBSDKCoreKit.AppLinkURL` 81 | */ 82 | public typealias AppLinkURL = FBSDKCoreKit.AppLinkURL 83 | 84 | /** 85 | Wrapper for `FBSDKCoreKit.AppLinkUtility` 86 | 87 | - SeeAlso: `FBSDKCoreKit.AppLinkUtility` 88 | */ 89 | public typealias AppLinkUtility = FBSDKCoreKit.AppLinkUtility 90 | 91 | /** 92 | Wrapper for `FBSDKCoreKit.ApplicationDelegate` 93 | 94 | - SeeAlso: `FBSDKCoreKit.ApplicationDelegate` 95 | */ 96 | public typealias ApplicationDelegate = FBSDKCoreKit.ApplicationDelegate 97 | 98 | /** 99 | Wrapper for `FBSDKCoreKit.CoreError` 100 | 101 | - SeeAlso: `FBSDKCoreKit.CoreError` 102 | */ 103 | public typealias CoreError = FBSDKCoreKit.CoreError 104 | 105 | /** 106 | Wrapper for `FBSDKCoreKit.FBAppLinkReturnToRefererView` 107 | 108 | - SeeAlso: `FBSDKCoreKit.FBAppLinkReturnToRefererView` 109 | */ 110 | public typealias FBAppLinkReturnToRefererView = FBSDKCoreKit.FBAppLinkReturnToRefererView 111 | 112 | /** 113 | Wrapper for `FBSDKCoreKit.FBButton` 114 | 115 | - SeeAlso: `FBSDKCoreKit.FBButton` 116 | */ 117 | public typealias FBButton = FBSDKCoreKit.FBButton 118 | 119 | /** 120 | Wrapper for `FBSDKCoreKit.FBProfilePictureView` 121 | 122 | - SeeAlso: `FBSDKCoreKit.FBProfilePictureView` 123 | */ 124 | public typealias FBProfilePictureView = FBSDKCoreKit.FBProfilePictureView 125 | 126 | /** 127 | Wrapper for `FBSDKCoreKit.GraphRequest` 128 | 129 | - SeeAlso: `FBSDKCoreKit.GraphRequest` 130 | */ 131 | public typealias GraphRequest = FBSDKCoreKit.GraphRequest 132 | 133 | /** 134 | Wrapper for `FBSDKCoreKit.GraphRequestConnection` 135 | 136 | - SeeAlso: `FBSDKCoreKit.GraphRequestConnection` 137 | */ 138 | public typealias GraphRequestConnection = FBSDKCoreKit.GraphRequestConnection 139 | 140 | /** 141 | Wrapper for `FBSDKCoreKit.GraphRequestDataAttachment` 142 | 143 | - SeeAlso: `FBSDKCoreKit.GraphRequestDataAttachment` 144 | */ 145 | public typealias GraphRequestDataAttachment = FBSDKCoreKit.GraphRequestDataAttachment 146 | 147 | /** 148 | Wrapper for `FBSDKCoreKit.GraphRequestError` 149 | 150 | - SeeAlso: `FBSDKCoreKit.GraphRequestError` 151 | */ 152 | public typealias GraphRequestError = FBSDKCoreKit.GraphRequestError 153 | 154 | /** 155 | Wrapper for `FBSDKCoreKit.HTTPMethod` 156 | 157 | - SeeAlso: `FBSDKCoreKit.HTTPMethod` 158 | */ 159 | public typealias HTTPMethod = FBSDKCoreKit.HTTPMethod 160 | 161 | /** 162 | Wrapper for `FBSDKCoreKit.LoggingBehavior` 163 | 164 | - SeeAlso: `FBSDKCoreKit.LoggingBehavior` 165 | */ 166 | public typealias LoggingBehavior = FBSDKCoreKit.LoggingBehavior 167 | 168 | /** 169 | Wrapper for `FBSDKCoreKit.MeasurementEvent` 170 | 171 | - SeeAlso: `FBSDKCoreKit.MeasurementEvent` 172 | */ 173 | public typealias MeasurementEvent = FBSDKCoreKit.MeasurementEvent 174 | 175 | /** 176 | Wrapper for `FBSDKCoreKit.Profile` 177 | 178 | - SeeAlso: `FBSDKCoreKit.Profile` 179 | */ 180 | public typealias Profile = FBSDKCoreKit.Profile 181 | 182 | /** 183 | Wrapper for `FBSDKCoreKit.Settings` 184 | 185 | - SeeAlso: `FBSDKCoreKit.Settings` 186 | */ 187 | public typealias Settings = FBSDKCoreKit.Settings 188 | 189 | /** 190 | Wrapper for `FBSDKCoreKit.TestUsersManager` 191 | 192 | - SeeAlso: `FBSDKCoreKit.TestUsersManager` 193 | */ 194 | public typealias TestUsersManager = FBSDKCoreKit.TestUsersManager 195 | 196 | /** 197 | Wrapper for `FBSDKCoreKit.Utility` 198 | 199 | - SeeAlso: `FBSDKCoreKit.Utility` 200 | */ 201 | public typealias Utility = FBSDKCoreKit.Utility 202 | 203 | /** 204 | Wrapper for `FBSDKCoreKit.WebViewAppLinkResolver` 205 | 206 | - SeeAlso: `FBSDKCoreKit.WebViewAppLinkResolver` 207 | */ 208 | public typealias WebViewAppLinkResolver = FBSDKCoreKit.WebViewAppLinkResolver 209 | 210 | // MARK: - Protocols 211 | 212 | /** 213 | Wrapper for `FBSDKCoreKit.AppLinkResolving` 214 | 215 | - SeeAlso: `FBSDKCoreKit.AppLinkResolving` 216 | */ 217 | public typealias AppLinkResolving = FBSDKCoreKit.AppLinkResolving 218 | 219 | /** 220 | Wrapper for `FBSDKCoreKit.AppLinkReturnToRefererControllerDelegate` 221 | 222 | - SeeAlso: `FBSDKCoreKit.AppLinkReturnToRefererControllerDelegate` 223 | */ 224 | public typealias AppLinkReturnToRefererControllerDelegate = FBSDKCoreKit.AppLinkReturnToRefererControllerDelegate 225 | 226 | /** 227 | Wrapper for `FBSDKCoreKit.AppLinkReturnToRefererViewDelegate` 228 | 229 | - SeeAlso: `FBSDKCoreKit.AppLinkReturnToRefererViewDelegate` 230 | */ 231 | public typealias AppLinkReturnToRefererViewDelegate = FBSDKCoreKit.AppLinkReturnToRefererViewDelegate 232 | 233 | /** 234 | Wrapper for `FBSDKCoreKit.Copying` 235 | 236 | - SeeAlso: `FBSDKCoreKit.Copying` 237 | */ 238 | public typealias Copying = FBSDKCoreKit.Copying 239 | 240 | /** 241 | Wrapper for `FBSDKCoreKit.GraphErrorRecoveryProcessorDelegate` 242 | 243 | - SeeAlso: `FBSDKCoreKit.GraphErrorRecoveryProcessorDelegate` 244 | */ 245 | public typealias GraphErrorRecoveryProcessorDelegate = FBSDKCoreKit.GraphErrorRecoveryProcessorDelegate 246 | 247 | /** 248 | Wrapper for `FBSDKCoreKit.GraphRequestConnectionDelegate` 249 | 250 | - SeeAlso: `FBSDKCoreKit.GraphRequestConnectionDelegate` 251 | */ 252 | public typealias GraphRequestConnectionDelegate = FBSDKCoreKit.GraphRequestConnectionDelegate 253 | 254 | /** 255 | Wrapper for `FBSDKCoreKit.MutableCopying` 256 | 257 | - SeeAlso: `FBSDKCoreKit.MutableCopying` 258 | */ 259 | public typealias MutableCopying = FBSDKCoreKit.MutableCopying 260 | -------------------------------------------------------------------------------- /Sources/Core/Internal/FBSDKSettingsInitializer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | @interface FBSDKSettingsInitializer : NSObject 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Sources/Core/Internal/FBSDKSettingsInitializer.m: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import "FBSDKSettingsInitializer.h" 20 | 21 | #import 22 | 23 | @interface FBSDKSettings (Internal) 24 | 25 | + (void)setUserAgentSuffix:(NSString *)suffix; 26 | 27 | @end 28 | 29 | @implementation FBSDKSettingsInitializer 30 | 31 | + (void)load 32 | { 33 | [FBSDKSettings setUserAgentSuffix:@"swift"]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Sources/Core/Internal/FacebookSwift-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import "FBSDKSettingsInitializer.h" 20 | -------------------------------------------------------------------------------- /Sources/Core/Settings.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import Foundation 20 | 21 | //-------------------------------------- 22 | // MARK: - SDKSettings 23 | //-------------------------------------- 24 | 25 | /** 26 | Provides access to settings and configuration used by the entire SDK. 27 | */ 28 | public extension Settings { 29 | //-------------------------------------- 30 | // MARK: - SDKSettings + Logging Behavior 31 | //-------------------------------------- 32 | 33 | /** 34 | Current logging behaviors of Facebook SDK. 35 | The default enabled behavior is `.DeveloperErrors` only. 36 | */ 37 | static var loggingBehaviors: Set { 38 | get { 39 | return Set(Settings.__loggingBehaviors.map { LoggingBehavior(rawValue: $0) }) 40 | } 41 | set { 42 | Settings.__loggingBehaviors = Set(newValue.map { $0.rawValue }) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Sources/Login/FBLoginButton.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import FacebookCore 20 | import UIKit 21 | 22 | /** 23 | A button that initiates a log in or log out flow upon tapping. 24 | 25 | `LoginButton` works with `AccessToken.current` to determine what to display, 26 | and automatically starts authentication when tapped (i.e., you do not need to manually subscribe action targets). 27 | 28 | Like `LoginManager`, you should make sure your app delegate is connected to `ApplicationDelegate` 29 | in order for the button's delegate to receive messages. 30 | 31 | `LoginButton` has a fixed height of @c 30 pixels, but you may change the width. 32 | Initializing the button with `nil` frame will size the button to its minimum frame. 33 | */ 34 | public extension FBLoginButton { 35 | /** 36 | Create a new `LoginButton` with a given optional frame and read permissions. 37 | 38 | - Parameter frame: Optional frame to initialize with. Default: `nil`, which uses a default size for the button. 39 | - Parameter permissions: Array of read permissions to request when logging in. 40 | */ 41 | convenience init(frame: CGRect = .zero, permissions: [Permission] = [.publicProfile]) { 42 | self.init(frame: frame) 43 | self.permissions = permissions.map { $0.name } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Sources/Login/FBSDKLoginKit+Typealiases.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import FBSDKLoginKit 20 | import Foundation 21 | 22 | // Typealiases for FBSDKLoginKit types to avoid having to import 23 | // dependent libraries. At somepoint these will be likely 24 | // become "wrapper" types that extend and enhance functionality 25 | // in addition to exposing it. For now it suffices to simply expose 26 | // them to the correct library aka. FacebookLogin 27 | 28 | // MARK: - Classes 29 | 30 | /** 31 | Wrapper for `FBSDKLoginKit.AccessToken` 32 | 33 | - SeeAlso: `FBSDKLoginKit.AccessToken` 34 | */ 35 | public typealias AccessToken = FBSDKLoginKit.AccessToken 36 | 37 | /** 38 | Wrapper for `FBSDKLoginKit.DefaultAudience` 39 | 40 | - SeeAlso: `FBSDKLoginKit.DefaultAudience` 41 | */ 42 | public typealias DefaultAudience = FBSDKLoginKit.DefaultAudience 43 | 44 | /** 45 | Wrapper for `FBSDKLoginKit.DeviceLoginCodeInfo` 46 | 47 | - SeeAlso: `FBSDKLoginKit.DeviceLoginCodeInfo` 48 | */ 49 | public typealias DeviceLoginCodeInfo = FBSDKLoginKit.DeviceLoginCodeInfo 50 | 51 | /** 52 | Wrapper for `FBSDKLoginKit.DeviceLoginError` 53 | 54 | - SeeAlso: `FBSDKLoginKit.DeviceLoginError` 55 | */ 56 | public typealias DeviceLoginError = FBSDKLoginKit.DeviceLoginError 57 | 58 | /** 59 | Wrapper for `FBSDKLoginKit.DeviceLoginManager` 60 | 61 | - SeeAlso: `FBSDKLoginKit.DeviceLoginManager` 62 | */ 63 | public typealias DeviceLoginManager = FBSDKLoginKit.DeviceLoginManager 64 | 65 | /** 66 | Wrapper for `FBSDKLoginKit.DeviceLoginManagerResult` 67 | 68 | - SeeAlso: `FBSDKLoginKit.DeviceLoginManagerResult` 69 | */ 70 | public typealias DeviceLoginManagerResult = FBSDKLoginKit.DeviceLoginManagerResult 71 | 72 | /** 73 | Wrapper for `FBSDKLoginKit.FBButton` 74 | 75 | - SeeAlso: `FBSDKLoginKit.FBButton` 76 | */ 77 | public typealias FBButton = FBSDKLoginKit.FBButton 78 | 79 | /** 80 | Wrapper for `FBSDKLoginKit.FBLoginButton` 81 | 82 | - SeeAlso: `FBSDKLoginKit.FBLoginButton` 83 | */ 84 | public typealias FBLoginButton = FBSDKLoginKit.FBLoginButton 85 | 86 | /** 87 | Wrapper for `FBSDKLoginKit.FBLoginTooltipView` 88 | 89 | - SeeAlso: `FBSDKLoginKit.FBLoginTooltipView` 90 | */ 91 | public typealias FBLoginTooltipView = FBSDKLoginKit.FBLoginTooltipView 92 | 93 | /** 94 | Wrapper for `FBSDKLoginKit.FBTooltipView` 95 | 96 | - SeeAlso: `FBSDKLoginKit.FBTooltipView` 97 | */ 98 | public typealias FBTooltipView = FBSDKLoginKit.FBTooltipView 99 | 100 | /** 101 | Wrapper for `FBSDKLoginKit.GraphRequestConnection` 102 | 103 | - SeeAlso: `FBSDKLoginKit.GraphRequestConnection` 104 | */ 105 | public typealias GraphRequestConnection = FBSDKLoginKit.GraphRequestConnection 106 | 107 | /** 108 | Wrapper for `FBSDKLoginKit.LoginAuthType` 109 | 110 | - SeeAlso: `FBSDKLoginKit.LoginAuthType` 111 | */ 112 | public typealias LoginAuthType = FBSDKLoginKit.LoginAuthType 113 | 114 | /** 115 | Wrapper for `FBSDKLoginKit.LoginBehavior` 116 | 117 | - SeeAlso: `FBSDKLoginKit.LoginBehavior` 118 | */ 119 | public typealias LoginBehavior = FBSDKLoginKit.LoginBehavior 120 | 121 | /** 122 | Wrapper for `FBSDKLoginKit.LoginError` 123 | 124 | - SeeAlso: `FBSDKLoginKit.LoginError` 125 | */ 126 | public typealias LoginError = FBSDKLoginKit.LoginError 127 | 128 | /** 129 | Wrapper for `FBSDKLoginKit.LoginManager` 130 | 131 | - SeeAlso: `FBSDKLoginKit.LoginManager` 132 | */ 133 | public typealias LoginManager = FBSDKLoginKit.LoginManager 134 | 135 | /** 136 | Wrapper for `FBSDKLoginKit.LoginManagerLoginResult` 137 | 138 | - SeeAlso: `FBSDKLoginKit.LoginManagerLoginResult` 139 | */ 140 | public typealias LoginManagerLoginResult = FBSDKLoginKit.LoginManagerLoginResult 141 | 142 | /** 143 | Wrapper for `FBSDKLoginKit.LoginManagerLoginResultBlock` 144 | 145 | - SeeAlso: `FBSDKLoginKit.LoginManagerLoginResultBlock` 146 | */ 147 | public typealias LoginManagerLoginResultBlock = FBSDKLoginKit.LoginManagerLoginResultBlock 148 | 149 | // MARK: - Protocols 150 | 151 | /** 152 | Wrapper for `FBSDKLoginKit.Copying` 153 | 154 | - SeeAlso: `FBSDKLoginKit.Copying` 155 | */ 156 | public typealias Copying = FBSDKLoginKit.Copying 157 | 158 | /** 159 | Wrapper for `FBSDKLoginKit.DeviceLoginManagerDelegate` 160 | 161 | - SeeAlso: `FBSDKLoginKit.DeviceLoginManagerDelegate` 162 | */ 163 | public typealias DeviceLoginManagerDelegate = FBSDKLoginKit.DeviceLoginManagerDelegate 164 | 165 | /** 166 | Wrapper for `FBSDKLoginKit.GraphRequestConnectionDelegate` 167 | 168 | - SeeAlso: `FBSDKLoginKit.GraphRequestConnectionDelegate` 169 | */ 170 | public typealias GraphRequestConnectionDelegate = FBSDKLoginKit.GraphRequestConnectionDelegate 171 | 172 | /** 173 | Wrapper for `FBSDKLoginKit.LoginButtonDelegate` 174 | 175 | - SeeAlso: `FBSDKLoginKit.LoginButtonDelegate` 176 | */ 177 | public typealias LoginButtonDelegate = FBSDKLoginKit.LoginButtonDelegate 178 | 179 | /** 180 | Wrapper for `FBSDKLoginKit.LoginTooltipViewDelegate` 181 | 182 | - SeeAlso: `FBSDKLoginKit.LoginTooltipViewDelegate` 183 | */ 184 | public typealias LoginTooltipViewDelegate = FBSDKLoginKit.LoginTooltipViewDelegate 185 | -------------------------------------------------------------------------------- /Sources/Login/LoginManager.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import FacebookCore 20 | import Foundation 21 | import UIKit 22 | 23 | /// Login Result Block 24 | public typealias LoginResultBlock = (LoginResult) -> Void 25 | 26 | /** 27 | Describes the result of a login attempt. 28 | */ 29 | public enum LoginResult { 30 | /// User succesfully logged in. Contains granted, declined permissions and access token. 31 | case success(granted: Set, declined: Set, token: AccessToken) 32 | /// Login attempt was cancelled by the user. 33 | case cancelled 34 | /// Login attempt failed. 35 | case failed(Error) 36 | 37 | internal init(result: LoginManagerLoginResult?, error: Error?) { 38 | guard let result = result, error == nil else { 39 | self = .failed(error ?? LoginError(.unknown)) 40 | return 41 | } 42 | 43 | guard !result.isCancelled, let token = result.token else { 44 | self = .cancelled 45 | return 46 | } 47 | 48 | let granted: Set = Set(result.grantedPermissions.map { Permission(stringLiteral: $0) }) 49 | let declined: Set = Set(result.declinedPermissions.map { Permission(stringLiteral: $0) }) 50 | self = .success(granted: granted, declined: declined, token: token) 51 | } 52 | } 53 | 54 | /** 55 | This class provides methods for logging the user in and out. 56 | It works directly with `AccessToken.current` and 57 | sets the "current" token upon successful authorizations (or sets `nil` in case of `logOut`). 58 | 59 | You should check `AccessToken.current` before calling `logIn()` to see if there is 60 | a cached token available (typically in your `viewDidLoad`). 61 | 62 | If you are managing your own token instances outside of `AccessToken.current`, you will need to set 63 | `current` before calling `logIn()` to authorize further permissions on your tokens. 64 | */ 65 | public extension LoginManager { 66 | /** 67 | Initialize an instance of `LoginManager.` 68 | 69 | - parameter loginBehavior: Optional login behavior to use. Default: `.Native`. 70 | - parameter defaultAudience: Optional default audience to use. Default: `.Friends`. 71 | */ 72 | convenience init(loginBehavior: LoginBehavior = .browser, defaultAudience: DefaultAudience = .friends) { 73 | self.init() 74 | self.loginBehavior = loginBehavior 75 | self.defaultAudience = defaultAudience 76 | } 77 | 78 | /** 79 | Logs the user in or authorizes additional permissions. 80 | 81 | Use this method when asking for read permissions. You should only ask for permissions when they 82 | are needed and explain the value to the user. You can inspect the `declinedPermissions` in the result to also 83 | provide more information to the user if they decline permissions. 84 | 85 | This method will present UI the user. You typically should check if `AccessToken.current` already 86 | contains the permissions you need before asking to reduce unnecessary app switching. 87 | 88 | - parameter permissions: Array of read permissions. Default: `[.PublicProfile]` 89 | - parameter viewController: Optional view controller to present from. Default: topmost view controller. 90 | - parameter completion: Optional callback. 91 | */ 92 | func logIn(permissions: [Permission] = [.publicProfile], 93 | viewController: UIViewController? = nil, 94 | completion: LoginResultBlock? = nil) { 95 | self.logIn(permissions: permissions.map { $0.name }, from: viewController, handler: sdkCompletion(completion)) 96 | } 97 | 98 | private func sdkCompletion(_ completion: LoginResultBlock?) -> LoginManagerLoginResultBlock? { 99 | guard let completion = completion else { 100 | return nil 101 | } 102 | return { (result: LoginManagerLoginResult?, error: Error?) in 103 | let result = LoginResult(result: result, error: error) 104 | completion(result) 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Sources/Share/Enums+Extensions.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import FBSDKShareKit 20 | 21 | /** 22 | ShareDialog.Mode CustomStringConvertible 23 | */ 24 | extension ShareDialog.Mode: CustomStringConvertible { 25 | /// The string description 26 | public var description: String { 27 | return __NSStringFromFBSDKShareDialogMode(self) 28 | } 29 | } 30 | 31 | /** 32 | AppGroupPrivacy CustomStringConvertible 33 | */ 34 | extension AppGroupPrivacy: CustomStringConvertible { 35 | /// The string description 36 | public var description: String { 37 | return __NSStringFromFBSDKAppGroupPrivacy(self) 38 | } 39 | } 40 | 41 | /** 42 | LikeObjectType CustomStringConvertible 43 | */ 44 | extension LikeObjectType: CustomStringConvertible { 45 | /// The string description 46 | public var description: String { 47 | return __NSStringFromFBSDKLikeObjectType(self) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Tests/FacebookCoreTests/FacebookCoreTests.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import XCTest 20 | 21 | class FacebookCoreTests: XCTestCase {} 22 | -------------------------------------------------------------------------------- /Tests/FacebookCoreTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Tests/FacebookLoginTests/FacebookLoginTests.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import XCTest 20 | 21 | class FacebookLoginTests: XCTestCase {} 22 | -------------------------------------------------------------------------------- /Tests/FacebookLoginTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Tests/FacebookShareTests/FacebookShareTests.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | import XCTest 20 | 21 | class FacebookShareTests: XCTestCase {} 22 | -------------------------------------------------------------------------------- /Tests/FacebookShareTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /scripts/travis/before_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 3 | # 4 | # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 5 | # copy, modify, and distribute this software in source code or binary form for use 6 | # in connection with the web services and APIs provided by Facebook. 7 | # 8 | # As with any software that integrates with the Facebook platform, your use of 9 | # this software is subject to the Facebook Developer Principles and Policies 10 | # [http://developers.facebook.com/policy/]. This copyright notice shall be 11 | # included in all copies or substantial portions of the software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | # -------------- 21 | # Main Script 22 | # -------------- 23 | 24 | if [ "$TEST_TYPE" = Lint ] || [ "$TEST_TYPE" = Carthage ]; then 25 | brew update 26 | fi 27 | -------------------------------------------------------------------------------- /scripts/travis/build_ios.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 3 | # 4 | # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 5 | # copy, modify, and distribute this software in source code or binary form for use 6 | # in connection with the web services and APIs provided by Facebook. 7 | # 8 | # As with any software that integrates with the Facebook platform, your use of 9 | # this software is subject to the Facebook Developer Principles and Policies 10 | # [http://developers.facebook.com/policy/]. This copyright notice shall be 11 | # included in all copies or substantial portions of the software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | # -------------- 21 | # Main Script 22 | # -------------- 23 | 24 | set -o pipefail 25 | xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme FacebookCore -configuration Debug -destination "platform=iOS Simulator,name=iPhone 5" -destination "platform=iOS Simulator,name=iPhone 7 Plus" | xcpretty -c 26 | xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme FacebookLogin -configuration Debug -destination "platform=iOS Simulator,name=iPhone 5" -destination "platform=iOS Simulator,name=iPhone 7 Plus" | xcpretty -c 27 | xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme FacebookShare -configuration Debug -destination "platform=iOS Simulator,name=iPhone 5" -destination "platform=iOS Simulator,name=iPhone 7 Plus" | xcpretty -c -------------------------------------------------------------------------------- /scripts/travis/build_samples.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 3 | # 4 | # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 5 | # copy, modify, and distribute this software in source code or binary form for use 6 | # in connection with the web services and APIs provided by Facebook. 7 | # 8 | # As with any software that integrates with the Facebook platform, your use of 9 | # this software is subject to the Facebook Developer Principles and Policies 10 | # [http://developers.facebook.com/policy/]. This copyright notice shall be 11 | # included in all copies or substantial portions of the software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | # -------------- 21 | # Main Script 22 | # -------------- 23 | 24 | set -o pipefail 25 | xcodebuild build -workspace FacebookSwift.xcworkspace -sdk iphonesimulator -scheme SwiftCatalog -configuration Debug -destination "platform=iOS Simulator,name=iPhone 5" -destination "platform=iOS Simulator,name=iPhone 7 Plus" | xcpretty -c -------------------------------------------------------------------------------- /scripts/travis/carthage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 3 | # 4 | # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 5 | # copy, modify, and distribute this software in source code or binary form for use 6 | # in connection with the web services and APIs provided by Facebook. 7 | # 8 | # As with any software that integrates with the Facebook platform, your use of 9 | # this software is subject to the Facebook Developer Principles and Policies 10 | # [http://developers.facebook.com/policy/]. This copyright notice shall be 11 | # included in all copies or substantial portions of the software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | # -------------- 21 | # Main Script 22 | # -------------- 23 | 24 | carthage build --no-skip-current 25 | -------------------------------------------------------------------------------- /scripts/travis/cocoapods.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 3 | # 4 | # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 5 | # copy, modify, and distribute this software in source code or binary form for use 6 | # in connection with the web services and APIs provided by Facebook. 7 | # 8 | # As with any software that integrates with the Facebook platform, your use of 9 | # this software is subject to the Facebook Developer Principles and Policies 10 | # [http://developers.facebook.com/policy/]. This copyright notice shall be 11 | # included in all copies or substantial portions of the software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | # -------------- 21 | # Main Script 22 | # -------------- 23 | 24 | pod lib lint FacebookCore.podspec --allow-warnings 25 | pod lib lint FacebookLogin.podspec --allow-warnings 26 | pod lib lint FacebookShare.podspec --allow-warnings 27 | -------------------------------------------------------------------------------- /scripts/travis/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 3 | # 4 | # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 5 | # copy, modify, and distribute this software in source code or binary form for use 6 | # in connection with the web services and APIs provided by Facebook. 7 | # 8 | # As with any software that integrates with the Facebook platform, your use of 9 | # this software is subject to the Facebook Developer Principles and Policies 10 | # [http://developers.facebook.com/policy/]. This copyright notice shall be 11 | # included in all copies or substantial portions of the software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | # -------------- 21 | # Main Script 22 | # -------------- 23 | 24 | gem update --system --no-document 25 | bundle install 26 | if [ "$TEST_TYPE" = Lint ]; then 27 | brew install swiftlint || brew upgrade swiftlint 28 | elif [ "$TEST_TYPE" = CocoaPods ]; then 29 | pod repo update --silent 30 | elif [ "$TEST_TYPE" = Carthage ]; then 31 | brew install carthage || brew upgrade carthage 32 | fi 33 | -------------------------------------------------------------------------------- /scripts/travis/lint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 3 | # 4 | # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 5 | # copy, modify, and distribute this software in source code or binary form for use 6 | # in connection with the web services and APIs provided by Facebook. 7 | # 8 | # As with any software that integrates with the Facebook platform, your use of 9 | # this software is subject to the Facebook Developer Principles and Policies 10 | # [http://developers.facebook.com/policy/]. This copyright notice shall be 11 | # included in all copies or substantial portions of the software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | # -------------- 21 | # Main Script 22 | # -------------- 23 | 24 | swiftlint lint --path Sources --quiet 25 | swiftlint lint --path Samples --quiet 26 | -------------------------------------------------------------------------------- /scripts/travis/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 3 | # 4 | # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 5 | # copy, modify, and distribute this software in source code or binary form for use 6 | # in connection with the web services and APIs provided by Facebook. 7 | # 8 | # As with any software that integrates with the Facebook platform, your use of 9 | # this software is subject to the Facebook Developer Principles and Policies 10 | # [http://developers.facebook.com/policy/]. This copyright notice shall be 11 | # included in all copies or substantial portions of the software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | # -------------- 21 | # Main Script 22 | # -------------- 23 | 24 | #shellcheck disable=SC1090 25 | 26 | if [ "$TEST_TYPE" = iOS ]; then 27 | . "$PWD/scripts/travis/build_ios.sh" 28 | elif [ "$TEST_TYPE" = Lint ]; then 29 | . "$PWD/scripts/travis/lint.sh" 30 | elif [ "$TEST_TYPE" = Samples ]; then 31 | . "$PWD/scripts/travis/build_samples.sh" 32 | elif [ "$TEST_TYPE" = CocoaPods ]; then 33 | . "$PWD/scripts/travis/cocoapods.sh" 34 | elif [ "$TEST_TYPE" = Carthage ]; then 35 | . "$PWD/scripts/travis/carthage.sh" 36 | fi 37 | --------------------------------------------------------------------------------