 ;; See http://clang.llvm.org/docs/ClangFormat.html
 (use-package clang-format :ensure t)
 
-(use-package company :ensure t)
-(use-package company-quickhelp :ensure t
-  :commands (company-quickhelp-mode))
-
-(use-package company-c-headers :ensure t
-  :config
-  (setq company-backends (delete 'company-semantic company-backends))
-  (setq company-minimum-prefix-length 2)
+(defun ar/swift-mode-hook-function ()
+  "Called when entering `swift-mode'."
+  (setq-local company-backends '(company-sourcekit)))
+
+(use-package swift-mode :ensure t
+  :after company-sourcekit
+  :config
+  (add-hook 'swift-mode-hook #'ar/swift-mode-hook-function))
+
+(use-package company :ensure t
+  :config
   (setq company-idle-delay 0.5)
   (setq company-show-numbers t)
+  (setq company-minimum-prefix-length 2)
+  (global-company-mode))
+
+(use-package company-sourcekit :ensure t
+  :after company)
+
+(use-package company-quickhelp :ensure t
+  :after company
+  :config
+  (company-quickhelp-mode +1))
+
+(use-package company-c-headers :ensure t
+  :after company
+  :config
+  (setq company-backends (delete 'company-semantic company-backends))
   (add-to-list 'company-backends 'company-c-headers)
   (bind-key "<backtab>" #'company-complete))
 
 (use-package company-emoji :ensure t
+  :after company
   :config
   (add-to-list 'company-backends 'company-emoji))
-
-(global-company-mode)
-(company-quickhelp-mode +1)
 
 ;; (add-to-list 'load-path
 ;;              (concat (getenv "HOME") "/.emacs.d/downloads/rtags/src"))

(use-package anaconda-mode :ensure t
  :commands (anaconda-mode))

(use-package company-anaconda :ensure t)

(use-package python-docstring :ensure t
  :commands (python-docstring-mode))

  ;; FIXME python-docstring-mode currently broken
  ;; (python-docstring-mode +1)
  (setq-local company-backends '(company-anaconda))
  (py-yapf-enable-on-save))
(add-hook 'python-mode-hook #'ar/python-mode-hook-function)

